0

I have every time this error If I use this code

import requests

proxy_list = [
    {"https": "45.14.173.23"},
]

for proxy in proxy_list:
    requests.get('https://iplogger.org/1QMwp7', proxies=proxy)

.

Error code: requests.exceptions.ProxyError: HTTPSConnectionPool(host='iplogger.org', port=443): Max retries exceeded with url: /1QMwp7 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))

I am sure that my proxy is working. But what's the problem?

  • Does this answer your question: https://stackoverflow.com/questions/8287628/proxies-with-python-requests-module? (you need to pass dictionary (not array) and add full IP Address) – Greg Dec 06 '20 at 12:18

1 Answers1

0
import requests
    
proxy_list = {
    "http": "https://ip:port",
    "https": "http://ip:port",
    }
    
requests.get('https://iplogger.org/1QMwp7', proxies=proxy_list)
Tonechas
  • 13,398
  • 16
  • 46
  • 80
epiczx
  • 1
  • 4
    Welcome to Stack Overflow! While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Sep 18 '21 at 08:30