mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 11:04:19 +01:00
test tor
This commit is contained in:
19
tests/test_tor.py
Normal file
19
tests/test_tor.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import requests
|
||||
from cashu.tor.tor import TorProxy
|
||||
|
||||
|
||||
def test_tor_setup():
|
||||
s = requests.Session()
|
||||
|
||||
tor = TorProxy(keep_alive=False)
|
||||
tor.wait_until_startup()
|
||||
socks_host, socks_port = "localhost", 9050
|
||||
|
||||
proxies = {
|
||||
"http": f"socks5://{socks_host}:{socks_port}",
|
||||
"https": f"socks5://{socks_host}:{socks_port}",
|
||||
}
|
||||
s.proxies.update(proxies)
|
||||
|
||||
resp = s.get("https://google.com")
|
||||
resp.raise_for_status()
|
||||
Reference in New Issue
Block a user