Why Tor cant access localhost pages
proxy, python, socks, tor
Solution
It is the way protocol is designed. When you send a request, it is transported to another machine on Internet with Socks5 envelope. So actual request is made from external server, thus accessing 127.0.0.1 is not possible.
Problem
I have Tor running and a python script to get web pages: ``` socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050) socket.socket = socks.socksocket print urllib2.urlopen(URL).read() ``` However, if the URL is ``` http://localhost/some_page.html ``` I get the following error: ``` raise Socks5Error(ord(resp[1]),_generalerrors[ord(resp[1])]) TypeError: __init__() takes exactly 2 arguments (3 given) ``` Can someone explain to me what exactly happens? Thank you.