fix: Some other places still need requests

This commit is contained in:
Sayantan Santra 2024-04-01 16:59:28 -05:00
parent 6cbe6454a3
commit f4cd430e9d
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
2 changed files with 6 additions and 7 deletions

View File

@ -11,7 +11,7 @@ requires-python = ">=3.6"
keywords = ["revanced", "patch"]
license = { file = "LICENSE" }
classifiers = ["Programming Language :: Python :: 3"]
dependencies = ["cloudscraper", "packaging", "bs4"]
dependencies = ["cloudscraper", "requests", "packaging", "bs4"]
version = "1.2"
[project.scripts]

View File

@ -4,8 +4,6 @@
# SPDX-License-Identifier: GPL-3.0-only
import os
import sys
import json
from packaging.version import Version
import cloudscraper as scraper
@ -90,17 +88,18 @@ def get_apks(appstate):
print('Downloading required apk files from APKPure...')
# Create a cloudscraper session
session = scraper.create_scraper()
# Get latest patches using the ReVanced API
try:
# Get the first result
patches_json = next(filter(
lambda x: x['repository'] == 'revanced/revanced-patches', appstate['tools']))
patches = req.get(patches_json['browser_download_url']).json()
except req.exceptions.RequestException as e:
patches = session.get(patches_json['browser_download_url']).json()
except session.exceptions.RequestException as e:
err_exit(f"Error fetching patches, {e}", appstate)
session = scraper.create_scraper()
for app in build_config:
# Check if we need to build an app
if not build_config[app].getboolean('build'):