mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Merge branch 'master' into 'master'
deploy: show HTTP errors when virustotal error fails. See merge request fdroid/fdroidserver!635
This commit is contained in:
commit
edfd3cf530
1 changed files with 6 additions and 3 deletions
|
@ -501,14 +501,14 @@ def upload_to_virustotal(repo_section, vt_apikey):
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "F-Droid"
|
"User-Agent": "F-Droid"
|
||||||
}
|
}
|
||||||
params = {
|
data = {
|
||||||
'apikey': vt_apikey,
|
'apikey': vt_apikey,
|
||||||
'resource': package['hash'],
|
'resource': package['hash'],
|
||||||
}
|
}
|
||||||
needs_file_upload = False
|
needs_file_upload = False
|
||||||
while True:
|
while True:
|
||||||
r = requests.post('https://www.virustotal.com/vtapi/v2/file/report',
|
r = requests.post('https://www.virustotal.com/vtapi/v2/file/report',
|
||||||
params=params, headers=headers)
|
data=data, headers=headers)
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
response = r.json()
|
response = r.json()
|
||||||
if response['response_code'] == 0:
|
if response['response_code'] == 0:
|
||||||
|
@ -535,7 +535,10 @@ def upload_to_virustotal(repo_section, vt_apikey):
|
||||||
'file': (filename, open(repofilename, 'rb'))
|
'file': (filename, open(repofilename, 'rb'))
|
||||||
}
|
}
|
||||||
r = requests.post('https://www.virustotal.com/vtapi/v2/file/scan',
|
r = requests.post('https://www.virustotal.com/vtapi/v2/file/scan',
|
||||||
params=params, headers=headers, files=files)
|
data=data, headers=headers, files=files)
|
||||||
|
logging.debug('If this upload fails, try manually uploading here:\n'
|
||||||
|
+ 'https://www.virustotal.com/')
|
||||||
|
r.raise_for_status()
|
||||||
response = r.json()
|
response = r.json()
|
||||||
|
|
||||||
logging.info(response['verbose_msg'] + " " + response['permalink'])
|
logging.info(response['verbose_msg'] + " " + response['permalink'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue