A
A
anya_hacker2021-10-24 18:11:04
Python
anya_hacker, 2021-10-24 18:11:04

How to fix an error when connecting a proxy?

I bought a proxy Socks, IPv6. Now I want to check if it's working, which gives me an error:

Traceback (most recent call last):
  File "C:\Users\ilyam\PycharmProjects\steam orders bot\parse_id.py", line 57, in <module>
    r = requests.get("https://www.google.com", proxies=proxies)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 500, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 997, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname

Proxy 45.89.18.238:5354, login/password: "oAQ6o", "89EpI4FXtY"
Code:
import requests
from requests_toolbelt.auth.http_proxy_digest import HTTPProxyDigestAuth

proxies = {
    "http": "http://45.89.18.238:5354",
    "https": "https://45.89.18.238:5354",
}
auth = HTTPProxyDigestAuth("oOAQ6o", "89EpI4FXtY")

# HTTPS
r = requests.get("https://www.google.com", proxies=proxies, auth=auth)
print(r.status_code)

There are also proxies, they have a similar error
: ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-24
@anya_hacker

You can rewrite in a similar format and remove the variableauth

proxies = {
    "http": "http://oOAQ6o:[email protected]:5354",
    "https": "https://oOAQ6o:[email protected]:5354",
}

Format:
http://user:[email protected]/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question