2016-05-27 74 views
0

我們正試圖通過我們的代理拒絕Virustotal API。 HTTP網站可通過代碼訪問,但HTTPS未通過。請求你們任何人發佈幾個有助於我們的示例代碼。Python 2.7中的HTTPS身份驗證

import postfile 
host = "www.virustotal.com" 
selector = "https://www.virustotal.com/vtapi/v2/file/scan" 
fields = [("apikey", "-- YOUR API KEY --")] 
file_to_send = open("test.txt", "rb").read() 
files = [("file", "test.txt", file_to_send)] 
json = postfile.post_multipart(host, selector, fields, files) 
print json 

回答

0

兩個想法設法

1)沒有HTTPS,你可以張貼到http://www.virustotal.com/vtapi/v2/file/scan

2)儘量蟒蛇請求庫

import requests 
params = {'apikey': '-YOUR API KEY HERE-'} 
files = {'file': ('myfile.exe', open('myfile.exe', 'rb'))} 
response = requests.post('https://www.virustotal.com/vtapi/v2/file/scan', files=files, params=params) 
json_response = response.json()