Programmatically make HTTP requests through proxies with Python

坚强是说给别人听的谎言 提交于 2019-12-06 04:24:33

问题


How do I use Python to make an HTTP request through a proxy?

What do I need to do to the following code?

urllib.urlopen('http://www.google.com')

回答1:


The urlopen function supports proxies. Try something like this:

urllib.urlopen(your_url, proxies = {"http" : "http://192.168.0.1:80"})



回答2:


You could look at PycURL. I use cURL a lot in PHP and i love it. Though there is probably a neat way to do this currently in Python.



来源:https://stackoverflow.com/questions/894168/programmatically-make-http-requests-through-proxies-with-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!