Requests in Python using proxy proxies

Source: Internet
Author: User

Learning the web crawler will inevitably encounter the use of agents, the following describes how to use requests to set up the agent:

If you need to use a proxy, you can configure a single request by providing proxies parameters for any of the request methods:

Import requests 
proxies = {"http": "http://10.10.1.10:3128", "https": "http://10.10.1.10:1080",} 
Requests.get ("http://example.org", proxies=proxies)

This can be verified through the IP test site is successfully using the agent http://ip.chinaz.com/(see your visit after the site of your IP is how much to judge)

About the requests of the problem of garbled problems can be viewed blog content.

A solution to the problem of requests using cookies can be viewed in the blog content.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.