2016-05-27 5 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() 
Pythonの要求ライブラリを試してみてください