python - Tor and Python3 using SocksiPy -


i copy pasted code post them, seems fine mine prints error , don't know why... how make urllib2 requests through tor in python? can me error?

import socks import socket socks.setdefaultproxy(socks.proxy_type_socks5, "127.0.0.1", 9150) socket.socket = socks.socksocket import urllib.request print(urllib.request.urlopen('http://www.google.com').read())   traceback (most recent call last): file "/users/raphael/desktop/whatsmyip.py", line 17, in <module> r = requests.get("http://checkip.dyn.com") file  "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/api.py", line 68, in return request('get', url, **kwargs) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 573, in send r = adapter.send(request, **kwargs) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/adapters.py", line 370, in send timeout=timeout file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen body=body, headers=headers) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 349, in _make_request conn.request(method, url, **httplib_request_kw) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/http/client.py", line 1088, in request self._send_request(method, url, body, headers) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/http/client.py", line 1126, in _send_request self.endheaders(body) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/http/client.py", line 1084, in endheaders self._send_output(message_body) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/http/client.py", line 922, in _send_output self.send(msg) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/http/client.py", line 857, in send self.connect() file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 155, in connect conn = self._new_conn() file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 134, in _new_conn (self.host, self.port), self.timeout, **extra_kw) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 78, in create_connection sock.connect(sa) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/socks.py", line 369, in connect self.__negotiatesocks5(destpair[0],destpair[1]) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/socks.py", line 176, in __negotiatesocks5 self.sendall("\x05\x01\x00") typeerror: 'str' not support buffer interface 

and know why? use module doesn't work!


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -