GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 6aa7e2b2 authored by Cecylia Bocovich's avatar Cecylia Bocovich

Retry failed downloads

- also fixed a bug where releases won't be deleted untless the assets
are removed first
parent ee8d5a85
#!/usr/bin/env python3
#pip3 install PyGithub
  • Nitpick: For a clean commit history, I suggest that each commit only contains what it must contain. For this change, which is unrelated, I would make a separate commit.

Please register or sign in to reply
from github import Github
import sys
......@@ -11,8 +13,12 @@ REPO_NAME = "TheTorProject/gettorbrowser"
failure = False
failed_uploads = []
def delete_old_releases(repo):
for release in repo.get_releases():
for asset in release.get_assets():
asset.delete_asset()
release.delete_release()
#Download list of tor browser releases and upload them to github
......@@ -28,10 +34,17 @@ def upload_files(release):
subprocess.check_call(["/usr/bin/wget", "--quiet", url])
release.upload_asset(filename)
except:
print("Error: failed to download "+url)
print("Please upload this file manually.")
failure = True
print("Error: failed to download "+url+". Will retry later.")
  • Very minor nitpick: Maybe have it print "failed to update" instead of "failed to download" because it could be either the download or the upload that failed?

Please register or sign in to reply
failed_uploads.append(url)
#Retry failed uploads
for url in failed_uploads:
filename = url.split('/')[-1]
try:
subprocess.check_call(["/usr/bin/wget", "--quiet", url])
release.upload_asset(filename)
except:
print("Error: failed to download "+url+". Please upload this file manually.")
Please register or sign in to reply
failure = True
def main(token):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment