Skip to content

Commit

Permalink
Check a different url if lineageos exists
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Mar 27, 2023
1 parent c985726 commit 21a7981
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions openandroidinstaller/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@

def get_download_link(devicecode: str) -> Optional[str]:
"""Check if a lineageOS version for this device exists on download.lineageos.com and return the respective download link."""
url = f"https://download.lineageos.org/{devicecode}"
url = f"https://download.lineageos.org/api/v2/devices/{devicecode}"
try:
logger.info(f"Checking {url}")
# Get Url
res = requests.get(url, timeout=5)
# if the request succeeds
if res.status_code == 200:
logger.info(f"{url} exists.")
return url
download_url = f"https://download.lineageos.org/devices/{devicecode}/builds"
logger.info(f"{download_url} exists.")
return download_url
else:
logger.info(f"{url} doesn't exist, status_code: {res.status_code}")
return None
Expand Down

0 comments on commit 21a7981

Please sign in to comment.