4

I am trying to connect to websites using HTTP proxies. I have tried using the requests modules' way:

import requests

proxies = {'http': '1.0.0.1:808'}

    a = requests.get('https://www.google.com', proxies=proxies)
    print(a.text)

This is the example code in the requests module's documentation. The code will print out the source of Google completely ignoring anything in the dictionary. I can't see what I'm doing wrong.

I have scoured the internet looking how to check and use a HTTP proxy in Python3 and have had no luck.

Everything I find is in Python 2.

Any help would be appreciated. Thank you.

1 Answer 1

1

You've only set a HTTP proxy, but you're making a HTTPS request. If you set https in the dictionary similar to http, you should have your proxy working.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah, brilliant! The love of debugging. haha. Pays off to have attention to detail. Thank you very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.