-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI helper, increase httpx version range
- Loading branch information
1 parent
9a44fb2
commit 56c1404
Showing
9 changed files
with
83 additions
and
134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
[tool.poetry] | ||
name = "dirgh" | ||
version = "0.2.1" | ||
version = "0.3.0" | ||
description = "With dirgh you can easily download a directory from GitHub programmatically from Python or using the CLI." | ||
authors = ["tiptenbrink <[email protected]>"] | ||
readme = "README.md" | ||
license = "Apache-2.0" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
httpx = ">=0.23.0, < 0.25.0" | ||
httpx = ">=0.23.0, < 0.26.0" | ||
trio = ">= 0.20.0, < 0.23.0" | ||
|
||
[tool.poetry.dev-dependencies] | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import getpass | ||
import os | ||
|
||
|
||
def find_token(env_prefix: str = "", ask_token: bool = False): | ||
# <env_prefix>DIRGH_GH_TOKEN | ||
pass_key = f"{env_prefix}dirgh_gh_token".replace('-', '_') | ||
pass_key_env = pass_key.upper() | ||
if ask_token: | ||
key_pass = getpass.getpass("Input your token:\n") | ||
else: | ||
key_pass = os.environ.get(pass_key_env) | ||
if key_pass is None: | ||
raise ValueError(f"Please supply token or set the {pass_key_env} environment variable!") | ||
|
||
return key_pass |