Skip to content

Commit

Permalink
wip: httpx add host header and disable verify
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Jul 18, 2024
1 parent 8675745 commit 33bf82c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cashu/wallet/v1_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,26 @@ async def wrapper(self, *args, **kwargs):
# set proxy
proxies_dict = {}
proxy_url: Union[str, None] = None
headers_dict = {"Client-version": settings.version}
if settings.tor and TorProxy().check_platform():
self.tor = TorProxy(timeout=True)
self.tor.run_daemon(verbose=True)
proxy_url = "socks5://localhost:9050"
elif settings.socks_proxy:
proxy_url = f"socks5://{settings.socks_proxy}"
headers_dict["Host"] = (
self.url.replace("https://", "")
.replace("http://", "")
.replace("/", "")
.replace(".", "")
)
elif settings.http_proxy:
proxy_url = settings.http_proxy
if proxy_url:
proxies_dict.update({"all://": proxy_url})

headers_dict = {"Client-version": settings.version}

self.httpx = httpx.AsyncClient(
verify=not settings.debug,
verify=False,
proxies=proxies_dict, # type: ignore
headers=headers_dict,
base_url=self.url,
Expand Down

0 comments on commit 33bf82c

Please sign in to comment.