Skip to content

Commit

Permalink
3.6.1
Browse files Browse the repository at this point in the history
- fix get_duration() month displayed as "m" to "mo"
- handles request errors in github_downloads()
  • Loading branch information
SirDank committed Apr 16, 2024
1 parent 86be4e1 commit ab6b8ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dankware/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_duration(then: datetime, now: datetime = None, interval: str = "default"

if seconds < 31536000:
months = int(seconds / 2592000)
if mini: return f"{months}m"
if mini: return f"{months}mo"
return f"{months} month{'s' if months > 1 else ''}"

years = int(seconds / 31536000)
Expand Down
4 changes: 3 additions & 1 deletion dankware/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def github_downloads(user_repo: str) -> tuple[str]:

response = requests.get(f"https://api.github.com/repos/{user_repo}/releases/latest", headers = {"User-Agent": "dankware"}, timeout=3).json()

return tuple(data["browser_download_url"] for data in response["assets"])
if response.status_code == 200:
return tuple(data["browser_download_url"] for data in response["assets"])
raise RuntimeError(f"Failed to get latest release from github: [{response.status_code}] {response.reason}")

def github_file_selector(user_repo: str, filter_mode: str, filter_iterable: list[str] | tuple[str]) -> tuple[str]:

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

license = "MIT",
name = "dankware",
version = "3.6",
version = "3.6.1",
author = "SirDank",

author_email = "SirDankenstein@protonmail.com",
Expand Down Expand Up @@ -47,9 +47,10 @@

package_dir = {"": "."},
packages = find_packages(where = "."),
extras_require={'extras': ['pillow']},
install_requires = [
"rich",
"colorama",
"requests",
],
]
)

0 comments on commit ab6b8ff

Please sign in to comment.