3

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.

1 Answers1

0

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.

Yevgeniy Kosmak
  • 3,561
  • 2
  • 10
  • 26
  • I don't believe that's the case. The plan I purchased allows me access to the proxy for 30 days with no specified data limits. I also purchased the proxy today so I don't think the error is in the provider. I set my proxy to my browser and have no problem browsing the web either. – Yusef Shakhtour Dec 27 '21 at 00:23
  • One more idea. Do you try to run your code with proxy URL of `https://:user:pass@proxy_ip:port`? The colon before the `user` — you also use it? Try without it. – Yevgeniy Kosmak Dec 27 '21 at 00:25
  • Huh, funny. Those vendors are so funny with HTTP error codes :) I'll add this to my answer. – Yevgeniy Kosmak Dec 27 '21 at 00:36