D
D
Dangerout2020-01-22 22:38:25
Python
Dangerout, 2020-01-22 22:38:25

Why is the get request not going through the proxy?

I've been learning python for a couple of months, so I don't understand a lot. In particular, I use the requests library and make a get request through a proxy in this form, but judging by the speed of the request, it goes directly, bypassing the proxy. What could be the matter and in general, how to determine whether the proxy is involved in the request or not?

requests.get('https://yandex.ru/', proxies={'http': 'http://139.59.53.106:8080'})

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Vasilyev, 2020-01-22
@Dangerout

It works something like this:

from requests import get
ip = get('http://api.ipify.org', proxies={'http': 'http://52.206.190.23:80'}).text
print ('My public IP address is:', ip)

And yes, if you substitute your proxy before the request falls - the output of your proxy does not work (for beauty, you need to insert an error handler there).

S
SagePtr, 2020-01-23
@SagePtr

Is it possible to make HTTPS requests through an HTTP proxy? They don't know how to forward other protocols besides plain unencrypted HTTP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question