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
Browse files

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
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.")
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.")
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