Skip to content

Commit

Permalink
fix asyncio proxies settings and update httpx version
Browse files Browse the repository at this point in the history
  • Loading branch information
RicterZ committed Dec 4, 2024
1 parent b9b8468 commit c2e880f
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 3 deletions.
5 changes: 5 additions & 0 deletions nhentai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import zipfile
import shutil
import copy

import httpx
import requests
Expand Down Expand Up @@ -46,6 +47,10 @@ async def async_request(method, url, proxies = None, **kwargs):
if proxies.get('http') == '' and proxies.get('https') == '':
proxies = None

if proxies:
_proxies = {f'{k}://': v for k, v in proxies.items() if v}
proxies = _proxies

async with httpx.AsyncClient(headers=headers, verify=False, proxies=proxies, **kwargs) as client:
response = await client.request(method, url, **kwargs)

Expand Down
119 changes: 117 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ beautifulsoup4 = "^4.11.2"
tabulate = "^0.9.0"
iso8601 = "^1.1.0"
urllib3 = "^1.26.14"
httpx = "0.27.2"


[build-system]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
httpx
httpx==0.27.2
requests
soupsieve
setuptools
Expand Down

0 comments on commit c2e880f

Please sign in to comment.