簡體   English   中英

當我使用virustotal API時,我使用requests.get並得到一個錯誤[Errno 11004] getaddrinfo failed

[英]When I use the virustotal API, I used requests.get and got an error [Errno 11004] getaddrinfo failed

我的代碼:

import requests
url = 'https://www.virustotal.com/vtapi/v2/file/behaviour'
params = {'apikey':'--private API--','hash':'0240ed7e45567f606793dafaff024acf'}
response = requests.get(url, params=params)
print response.json()

我收到錯誤:requests.exceptions.ConnectionError:

HTTPSConnectionPool(主機= 'vtcuckoo.commondatastorage.googleapis.com',端口= 443):最大重試網址為超出:/14461260f9b3988d4eb4e46bc7d9861172266a9a01bf15c57916a9e4f9dc0618?GoogleAccessId=758681729565-rc7fgq07icj8c9dm2gi34a4cckv235v1@developer.gserviceaccount.com&Expires=1529402918&Signature=P5JSJJvot6%2B1%2FIHCOs9RZWSofnTxiEDwRRhUwoM5YnDnLFf8Rq9LGEu5nPMegBQ1D9r8pZCluy2k%0AbdK70w% 2BiRCLgXtplNTnKFEqSRu9oyI7jUXLeeObMbEht7mlxjkiKkrNzbtLm9lE6kL7UUcRYYuXp%0AKwhoN9jJez3aTvnJBEU%3D(由NewConnectionError引起(':get10dr0r4信息失敗)建立新的連接失敗

為什么?

嗨,嘗試將 URL 更改為文件/報告。

 params = {'apikey': '', 'resource':hash}
 headers = {"Accept-Encoding": "gzip, deflate","User-Agent" : "gzip,  My Python requests library example client or username"}
 response_dict = requests.get('https://www.virustotal.com/vtapi/v2/file/report', params=params).json()

作為參考檢查這個 repo Virustotal_apiclient

您需要在參數中插入私有 API。 為了獲得私有 API,您需要注冊https://virustotal.com

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM