mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🎨 Updated function name
This commit is contained in:
@@ -10,7 +10,7 @@ from google_play_scraper.exceptions import GooglePlayScraperException
|
|||||||
|
|
||||||
from src.exceptions import APKMirrorScrapperFailure
|
from src.exceptions import APKMirrorScrapperFailure
|
||||||
from src.patches import Patches
|
from src.patches import Patches
|
||||||
from src.utils import handle_response
|
from src.utils import handle_github_response
|
||||||
|
|
||||||
not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png"
|
not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png"
|
||||||
headers = {
|
headers = {
|
||||||
@@ -105,7 +105,7 @@ def generate_markdown_table(data: List[List[str]]) -> str:
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
repo_url = "https://api.revanced.app/v2/patches/latest"
|
repo_url = "https://api.revanced.app/v2/patches/latest"
|
||||||
response = requests.get(repo_url)
|
response = requests.get(repo_url)
|
||||||
handle_response(response)
|
handle_github_response(response)
|
||||||
|
|
||||||
parsed_data = response.json()
|
parsed_data = response.json()
|
||||||
compatible_packages = parsed_data["patches"]
|
compatible_packages = parsed_data["patches"]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from src.config import RevancedConfig
|
|||||||
from src.downloader.utils import implement_method
|
from src.downloader.utils import implement_method
|
||||||
from src.exceptions import PatchingFailed
|
from src.exceptions import PatchingFailed
|
||||||
from src.patches import Patches
|
from src.patches import Patches
|
||||||
from src.utils import handle_response
|
from src.utils import handle_github_response
|
||||||
|
|
||||||
|
|
||||||
class Downloader(object):
|
class Downloader(object):
|
||||||
@@ -54,7 +54,7 @@ class Downloader(object):
|
|||||||
stream=True,
|
stream=True,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
handle_response(response)
|
handle_github_response(response)
|
||||||
total = int(response.headers.get("content-length", 0))
|
total = int(response.headers.get("content-length", 0))
|
||||||
bar = tqdm(
|
bar = tqdm(
|
||||||
desc=file_name,
|
desc=file_name,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from loguru import logger
|
|||||||
|
|
||||||
from src.config import RevancedConfig
|
from src.config import RevancedConfig
|
||||||
from src.downloader.download import Downloader
|
from src.downloader.download import Downloader
|
||||||
from src.utils import handle_response, update_changelog
|
from src.utils import handle_github_response, update_changelog
|
||||||
|
|
||||||
|
|
||||||
class Github(Downloader):
|
class Github(Downloader):
|
||||||
@@ -35,7 +35,7 @@ class Github(Downloader):
|
|||||||
logger.debug("Using personal access token")
|
logger.debug("Using personal access token")
|
||||||
headers["Authorization"] = f"token {self.config.personal_access_token}"
|
headers["Authorization"] = f"token {self.config.personal_access_token}"
|
||||||
response = requests.get(repo_url, headers=headers)
|
response = requests.get(repo_url, headers=headers)
|
||||||
handle_response(response)
|
handle_github_response(response)
|
||||||
if repo_name == "revanced-patches":
|
if repo_name == "revanced-patches":
|
||||||
download_url = response.json()["assets"][1]["browser_download_url"]
|
download_url = response.json()["assets"][1]["browser_download_url"]
|
||||||
else:
|
else:
|
||||||
@@ -78,7 +78,7 @@ class Github(Downloader):
|
|||||||
if config.personal_access_token:
|
if config.personal_access_token:
|
||||||
headers["Authorization"] = f"token {config.personal_access_token}"
|
headers["Authorization"] = f"token {config.personal_access_token}"
|
||||||
response = requests.get(api_url, headers=headers)
|
response = requests.get(api_url, headers=headers)
|
||||||
handle_response(response)
|
handle_github_response(response)
|
||||||
assets = response.json()["assets"]
|
assets = response.json()["assets"]
|
||||||
try:
|
try:
|
||||||
filter_pattern = re.compile(asset_filter)
|
filter_pattern = re.compile(asset_filter)
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ def update_changelog(name: str, response: Dict[str, str]) -> None:
|
|||||||
file1.write(change_log)
|
file1.write(change_log)
|
||||||
|
|
||||||
|
|
||||||
def handle_response(response: Response) -> None:
|
def handle_github_response(response: Response) -> None:
|
||||||
"""Handle Get Request Response."""
|
"""Handle Get Request Response."""
|
||||||
response_code = response.status_code
|
response_code = response.status_code
|
||||||
if response_code != 200:
|
if response_code != 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user