T
T
Tayrus02019-12-21 15:40:30
Python
Tayrus0, 2019-12-21 15:40:30

Why don't sock proxies work for me?

I run tor

C:\Users\ALEX\Desktop\tor\Tor>tor.exe -f C:\Users\ALEX\Desktop\tor\torrc
Dec 21 15:34:39.536 [notice] Tor 0.4.0.5 (git-bf071e34aa26e096) running on Windows 8 [or later] with Libevent 2.1.8-stable, OpenSSL 1.0.2s, Zlib 1.2.11, Liblzma N/A, and Libzstd N/A.
Dec 21 15:34:39.538 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Dec 21 15:34:39.553 [notice] Read configuration file "C:\Users\ALEX\Desktop\tor\torrc".
Dec 21 15:34:39.557 [warn] Path for GeoIPFile (<default>) is relative and will resolve to C:\Users\ALEX\Desktop\tor\Tor\<default>. Is this what you wanted?
Dec 21 15:34:39.558 [warn] Path for GeoIPv6File (<default>) is relative and will resolve to C:\Users\ALEX\Desktop\tor\Tor\<default>. Is this what you wanted?
Dec 21 15:34:39.560 [notice] Opening Socks listener on 127.0.0.1:9050
Dec 21 15:34:39.560 [notice] Opened Socks listener on 127.0.0.1:9050
Dec 21 15:34:39.000 [notice] Bootstrapped 0% (starting): Starting
Dec 21 15:34:41.000 [notice] Starting with guard context "default"
Dec 21 15:34:42.000 [notice] Bootstrapped 5% (conn): Connecting to a relay
Dec 21 15:34:42.000 [notice] Bootstrapped 10% (conn_done): Connected to a relay
Dec 21 15:34:42.000 [notice] Bootstrapped 14% (handshake): Handshaking with a relay
Dec 21 15:34:42.000 [notice] Bootstrapped 15% (handshake_done): Handshake with a relay done
Dec 21 15:34:42.000 [notice] Bootstrapped 75% (enough_dirinfo): Loaded enough directory info to build circuits
Dec 21 15:34:42.000 [notice] Bootstrapped 90% (ap_handshake_done): Handshake finished with a relay to build circuits
Dec 21 15:34:42.000 [notice] Bootstrapped 95% (circuit_create): Establishing a Tor circuit
Dec 21 15:34:43.000 [notice] Bootstrapped 100% (done): Done


My code

import requests
proxies = {'http': "socks5://127.0.0.1:9050"}
s = requests.get('http://2ip.ru', proxies=proxies)
print(s.text)


Gives an error message

Traceback (most recent call last):
  File "dbg.py", line 3, in <module>
    s = requests.get('http://2ip.ru', proxies=proxies)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py", line 337, in send
    conn = self.get_connection(request.url, proxies)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py", line 245, in get_connection
    proxy_manager = self.proxy_manager_for(proxy)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py", line 155, in proxy_manager_for
    **proxy_kwargs)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\packages\urllib3\poolmanager.py", line 280, in proxy_from_url
    return ProxyManager(proxy_url=url, **kw)
  File "C:\Users\ALEX\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\packages\urllib3\poolmanager.py", line 231, in __init__
    'Not supported proxy scheme %s' % proxy.scheme
AssertionError: Not supported proxy scheme socks5

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Priluzkiy, 2019-12-21
@Tayrus0

AssertionError: Not supported proxy scheme socks5

Is the library you are using not able to Socks? Most likely so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question