0

I am trying to connect to TOR's localhost loopback and send data through it. The address I am using is:

127.0.0.1:9050

I am using the following script to do this:

import requesocks, requests
session = requesocks.session()
session.proxies = {'http':  'socks5://127.0.0.1:9050',
                   'https': 'socks5://127.0.0.1:9050'}
print session.get("https://api.ipify.org?format=json").json()

It is supposed to retrieve my IP and print it. However, it gives the following error:

Max retries exceeded with url: https://api.ipify.org/?format=json

I can verify that TOR is up and running. What could be the problem raising this exception?

Rob
  • 115
  • 1
  • 2
  • 10
  • Code runs fine for me. calling .json() would error though, you want .content, does `session.get("http://ipecho.net/plain").content` throw the same error? – Padraic Cunningham May 07 '16 at 17:29
  • Yes, it does throw the same error... Is there any specific version of TOR I need? I have the regular browser installed; but is there a command line or something I am missing? I can't think of anything else. – Rob May 07 '16 at 19:36
  • How did you start tor? You do actually have tor running as a service and not just the browser bundle? – Padraic Cunningham May 07 '16 at 19:37
  • How would I run tor as a service? it's not accessible via command line – Rob May 07 '16 at 19:46
  • What os are you using? – Padraic Cunningham May 07 '16 at 20:02
  • 1
    Windows, but I got it working. I had to install the "expert" installer and add the exe to my PATH. Thank you – Rob May 07 '16 at 20:05

1 Answers1

1

I got it working. I had to install the "expert" installer and add the exe to my PATH. Thank you

Rob
  • 115
  • 1
  • 2
  • 10