mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 19:14:19 +01:00
@@ -1,22 +1,22 @@
|
||||
import httpx
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from cashu.tor.tor import TorProxy
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.skip(reason="Tor is not installed on CI")
|
||||
def test_tor_setup():
|
||||
s = requests.Session()
|
||||
|
||||
async def test_tor_setup():
|
||||
tor = TorProxy(timeout=False)
|
||||
tor.run_daemon()
|
||||
socks_host, socks_port = "localhost", 9050
|
||||
|
||||
proxies = {
|
||||
"http": f"socks5://{socks_host}:{socks_port}",
|
||||
"https": f"socks5://{socks_host}:{socks_port}",
|
||||
"all://": f"socks5://{socks_host}:{socks_port}",
|
||||
}
|
||||
s.proxies.update(proxies)
|
||||
client = httpx.AsyncClient(
|
||||
proxies=proxies, # type: ignore
|
||||
)
|
||||
|
||||
resp = s.get("https://google.com")
|
||||
resp = await client.get("https://www.wikipedia.org/")
|
||||
resp.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user