1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python Request use Proxy

Discussion in 'Programming' started by tagslyf, Dec 22, 2016.

Tags:
  1. tagslyf

    tagslyf Newbie

    Joined:
    Dec 22, 2016
    Messages:
    3
    Likes Received:
    0
    Gender:
    Male
    So I'm coding some script to send URL request(POST) with Proxy but I'm stuck with some problems.

    Is any one here can give me some tips or code reference for me to help me guide to do the right code for that.

    Any help will be much appreciated.
     
  2. mihai1497

    mihai1497 Jr. VIP Jr. VIP

    Joined:
    Jul 22, 2013
    Messages:
    765
    Likes Received:
    112
    Home Page:
    You can use the requests module, it's really easy to set proxies using it.

    Here is an example:
    Code:
    import requests
    
    proxies = {
      'http': 'http://10.10.1.10:3128',
      'https': 'http://10.10.1.10:1080',
    }
    
    requests.get('http://example.org', proxies=proxies)
    Check out their docs for more information: http://docs.python-requests.org/en/master/user/advanced/#proxies
     
    • Thanks Thanks x 1