Proxy connection with Python

后端 未结 4 760
陌清茗
陌清茗 2021-01-06 01:06

I have been attempting to connect to URLs from python. I have tried: urllib2, urlib3, and requests. It is the same issue that i run up against in all cases. Once I get th

4条回答
  •  臣服心动
    2021-01-06 01:39

    import requests
    proxies = {'https':'https://username:password@1.4.1.2:8080'}
    r = requests.get('http://www.example.com', proxies = proxies)
    print r.status_code, r.reason
    

    A working Solution! Tested on my server

提交回复
热议问题