Python Forum

Full Version: Code is not responding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to run tor with python requests module so i write this code but this code is not responding and not showing any error
what's the error in this code please help
from stem import Signal
from stem.control import Controller
import requests

def change_ip():
    with Controller.from_port(port=9051) as contr:
        contr.authenticate()
        contr.signal(Signal.NEWNYM)


session=requests.session()
session.proxies['http']='socks5://127.0.0.1:9051'
session.proxies['https']='socks5://127.0.0.1:9051'


for i in range(5):
    response=session.get('http://httpbin.org/ip')
    print(response.text)
    change_ip()
i did not apply the password in tor configuration file, still the code is not responding
please help