torsocks

Unable to make python requests over tor ConnectionRefusedError: [WinError 10061]

廉价感情. 提交于 2021-02-10 18:39:57
问题 I am trying to make requests using python requests over tor, but i get the error "ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it". Here is the code i am using: import requests def get_tor_session(): session = requests.session() # Tor uses the 9050 port as the default socks port session.proxies = {'http': 'socks5://127.0.0.1:9050', 'https': 'socks5://127.0.0.1:9050'} return session # Make a request through the Tor connection

Unable to make python requests over tor ConnectionRefusedError: [WinError 10061]

五迷三道 提交于 2021-02-10 18:33:10
问题 I am trying to make requests using python requests over tor, but i get the error "ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it". Here is the code i am using: import requests def get_tor_session(): session = requests.session() # Tor uses the 9050 port as the default socks port session.proxies = {'http': 'socks5://127.0.0.1:9050', 'https': 'socks5://127.0.0.1:9050'} return session # Make a request through the Tor connection

General SOCKS server failure with python tor but working from tor browser

喜欢而已 提交于 2019-12-25 08:04:10
问题 I would like to use tor from python to automate requests. I made a test with a page to check IP and it works. I then pointed to the site I want to, and apparently they avoid a tor endpoint because (see stack trace below) - but it works from tor browser. Any better way to debug response of browser? (e.g. connection refused) Which things I am missing to query from python instead than from browser? I am trying with something like: socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 , "127.0.0.1", 9150