Home > Software design >  Constant Error Trying to Use Proxy to Request IP via httpbin.org
Constant Error Trying to Use Proxy to Request IP via httpbin.org

Time:12-27

I've been looking around trying to find a solution, but nothing has worked. I have this code:

import requests, re
import time


proxies = {
    'http': 'http://:user:pass@proxy_ip:port',
    'https': 'https://:user:pass@proxy_ip:port'
    }

r = requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.text)

I'm getting this error: requests.exceptions.ProxyError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

I have tried rewriting with urllib as per this post: link

I have tried adding authentication arguments to the request as per this post: link

I have tried upgrading and or downgrading my requests library as per this post and a few other related posts: link

I have tried adding all headers from the request and that also does nothing.

I am using a static proxy from IPRoyal's proxy service and have double checked to be sure that HTTPS requests are supported for the proxy I paid for.

Any and all help is appreciated, please let me know if any further information is needed and I will try to provide it.

CodePudding user response:

Answer that worked

You need to remove the colon from proxy URL, the redundant one is before the user.

Another possibility (first answer)

I'm virtually sure that all problem is you've reached the limit of requests and the vendor forbids you to send more. You can test it with curl:

curl -x <YOUR_PROXY_URL> https://httpbin.org/

I'm pretty sure you'll have the same 407 error.

If you don't have curl or don't know what it is, you can just set your proxy to your browser and see that error as well.

  • Related