[Python] Python tor Requests for new ip

Discussão em 'Python' iniciado por Stack, Setembro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I cannot get a tor IP. I have tried the below script and according to a few websites this is correct.

    import requests

    def get_tor_session():
    session = requests.session()

    session.proxies = {'http': 'socks5://127.0.0.1:9050',
    'https': 'socks5://127.0.0.1:9050'}
    return session

    session = get_tor_session()
    print(session.get("https://ipinfo.io/what-is-my-ip").text)


    I have tried to add the errors I am getting to this post and I am getting my code is not formatted properly.

    tionError: Error connecting to SOCKS5 proxy 127.0.0.1:9050: [WinError 10061] No connection could be made because the target machine actively refused it

    raise NewConnectionError(
    self, f"Failed to establish a new connection: {error}"

    Continue reading...

Compartilhe esta Página