Fix github error ...

This commit is contained in:
Lovi 2024-06-16 18:29:40 +02:00
parent 6fd433aac3
commit 12103515ab
3 changed files with 7 additions and 11 deletions

View File

@ -5,7 +5,7 @@ import time
# Internal utilities # Internal utilities
from .version import __version__ from .version import __version__, __author__, __title__
from Src.Util.console import console from Src.Util.console import console
@ -14,8 +14,6 @@ import httpx
# Variable # Variable
repo_name = "StreamingCommunity_api"
repo_user = "ghost6446"
main = os.path.abspath(os.path.dirname(__file__)) main = os.path.abspath(os.path.dirname(__file__))
@ -28,8 +26,8 @@ def update():
# Make the GitHub API requests and handle potential errors # Make the GitHub API requests and handle potential errors
try: try:
response_reposity = httpx.get(f"https://api.github.com/repos/{repo_user}/{repo_name}").json() response_reposity = httpx.get(f"https://api.github.com/repos/{__author__}/{__title__}").json()
response_releases = httpx.get(f"https://api.github.com/repos/{repo_user}/{repo_name}/releases").json() response_releases = httpx.get(f"https://api.github.com/repos/{__author__}/{__title__}/releases").json()
except Exception as e: except Exception as e:
console.print(f"[red]Error accessing GitHub API: {e}") console.print(f"[red]Error accessing GitHub API: {e}")
@ -60,7 +58,7 @@ def update():
console.print(f"[red]Everything is up to date") console.print(f"[red]Everything is up to date")
console.print("\n") console.print("\n")
console.print(f"[red]{repo_name} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\ console.print(f"[red]{__title__} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\
[cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!") [cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!")
console.print("\n") console.print("\n")

View File

@ -1,5 +1,5 @@
__title__ = 'StreamingCommunity' __title__ = 'StreamingCommunity'
__version__ = 'v1.1.0' __version__ = 'v1.2.0'
__author__ = 'Lovi-0' __author__ = 'Lovi-0'
__description__ = 'A command-line program to download film' __description__ = 'A command-line program to download film'
__copyright__ = 'Copyright 2024' __copyright__ = 'Copyright 2024'

6
run.py
View File

@ -110,10 +110,8 @@ def initialize():
sys.exit(0) sys.exit(0)
# Attempting GitHub update # Attempting GitHub update
try: git_update()
git_update()
except Exception as e:
console.print(f"[blue]Req github [white]=> [red]Failed: {e}")
def main(): def main():