gawen / virustotal

💊 VirusTotal Public API 2.0 client for Python 2.x
https://www.virustotal.com/
155 stars 61 forks source link

recognize and set proxy #11

Open kel50 opened 6 years ago

kel50 commented 6 years ago

I'm using this module behind a proxy and had to make some slight modifications for it to work. So I'd suggest to check the environment for a proxy and set it in httplib2 using PySocks:

import httplib2
# detect presense of proxy and use env varibles if they exist
pi = httplib2.proxy_info_from_environment()
if pi:
    import socks
    socks.setdefaultproxy(pi.proxy_type, pi.proxy_host, pi.proxy_port)
    socks.wrapmodule(httplib2)  

source: https://stackoverflow.com/a/46206122