For This
For This

Reputation: 173

Can't make requests by proxies python3

I am Trying to make a request using proxy and i don't know why i


loadproxy = {
    "https":"114.99.11.114:3000",
    "http":"114.99.11.114:3000",
}

url = "http://httpbin.org/ip"

res = requests.get(url,proxies=loadproxy)


print(res.text)



File "/usr/lib/python3/dist-packages/requests/adapters.py", line 502, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPConnectionPool(host='114.99.11.114', port=3000): Max retries exceeded with url: http://httpbin.org/ip (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',)))

I Don't know why it is working acc to error the proxy is not working but i have changed a lot of proxy looking for help

One More Detain to add that while i am changing the proxy and i changed it and my code looks li

loadproxy = {
    "https":"118.69.50.154:80",
    "http":"118.69.50.154:80",
}

url = "http://httpbin.org/ip"

res = requests.get(url,proxies=loadproxy)


print(res.text)


but the problem here is it is showing my original ip

{ "origin": "my_ip" }

and even the proxy is anonymous

Upvotes: 0

Views: 681

Answers (1)

Błotosmętek
Błotosmętek

Reputation: 12927

print(requests.get("http://httpbin.org/ip",proxies={"http":"http://118.69.50.154:80"}).text)

worked for me and produced:

{
    "origin": "210.245.110.254"  
}

which is definitely not my IP.

Upvotes: 0

Related Questions