Skip to content

Commit

Permalink
Merge pull request #38 from orix-software/develop
Browse files Browse the repository at this point in the history
fix retry
  • Loading branch information
jedeoric authored Nov 16, 2023
2 parents c7fc681 + 864e5a2 commit 16dd636
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions tools/functions/get_http_oric_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_all_software_from_oric_org():
datastore = json.loads(get_body.decode('utf8'))
return datastore

def RetrieveSoftwareInTmpFolder(pathFileToDownload, tmpfolderRetrieveSoftware):
def RetrieveSoftwareInTmpFolder(pathFileToDownload, tmpfolderRetrieveSoftware) -> int:

head, tail = os.path.split(pathFileToDownload)

Expand Down Expand Up @@ -65,8 +65,12 @@ def RetrieveSoftwareInTmpFolder(pathFileToDownload, tmpfolderRetrieveSoftware):
crl_tape.setopt(crl_tape.WRITEDATA, b_obj_tape)

# Perform a file transfer
crl_tape.perform()

try:
crl_tape.perform()
except pycurl.error as e:
# Gestion des exceptions Curl
print("Erreur Curl :", e)
return 1
# End curl session
crl_tape.close()

Expand All @@ -84,3 +88,4 @@ def RetrieveSoftwareInTmpFolder(pathFileToDownload, tmpfolderRetrieveSoftware):
f = open("cache/softwares/"+tail, "wb")
f.write(get_body_tape)
f.close()
return 0
9 changes: 8 additions & 1 deletion tools/retrieveSoftwareOricOrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,17 @@ def manage_download(tsoftware, download_file, download_platform, download_label,
programmer_software = tsoftware["programmer_software"]
category_software = tsoftware["category_software"]

nb_curl_error = 0

if download_file != "":
print(f"Download file : { download_file }")
print(f"[download_file] Retrieve download file { download_file } to { tmpfolderRetrieveSoftware }")
RetrieveSoftwareInTmpFolder(download_file, tmpfolderRetrieveSoftware)

while (RetrieveSoftwareInTmpFolder(download_file, tmpfolderRetrieveSoftware) == 1):
nb_curl_error = nb_curl_error + 1
if nb_curl_error == 20:
exit()

extension = getFileExtension(download_file)
head, tail = os.path.split(download_file)
letter = tail[0:1].lower()
Expand Down

0 comments on commit 16dd636

Please sign in to comment.