简体   繁体   中英

Programmatically make HTTP requests through proxies with Python

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')

The urlopen function supports proxies. Try something like this:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM