Skip to content

Commit 471e9f0

Browse files
Arrowargithub-actions[bot]
authored andcommitted
Fix 'proxy' by @fdemusso #423
1 parent 4aaa929 commit 471e9f0

File tree

2 files changed

+59
-27
lines changed

2 files changed

+59
-27
lines changed

.github/.domain/domains.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cb01new": {
3-
"domain": "skin",
4-
"full_url": "https://cb01net.skin/",
5-
"old_domain": "bond",
6-
"time_change": "2025-10-20 18:31:05"
3+
"domain": "website",
4+
"full_url": "https://cb01net.website/",
5+
"old_domain": "skin",
6+
"time_change": "2025-10-27 16:27:56"
77
},
88
"animeunity": {
99
"domain": "so",
@@ -36,10 +36,10 @@
3636
"time_change": "2025-09-06 18:24:29"
3737
},
3838
"streamingcommunity": {
39-
"domain": "lu",
40-
"full_url": "https://streamingcommunityz.lu/",
41-
"old_domain": "tv",
42-
"time_change": "2025-10-22 15:21:12"
39+
"domain": "ch",
40+
"full_url": "https://streamingcommunityz.ch/",
41+
"old_domain": "lu",
42+
"time_change": "2025-10-27 12:45:04"
4343
},
4444
"altadefinizionegratis": {
4545
"domain": "ist",

StreamingCommunity/Util/http_client.py

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,31 @@ def create_client(
7272
follow_redirects: bool = True,
7373
) -> httpx.Client:
7474
"""Factory for a configured httpx.Client."""
75-
return httpx.Client(
76-
headers=_default_headers(headers),
77-
cookies=cookies,
78-
timeout=timeout if timeout is not None else _get_timeout(),
79-
verify=_get_verify() if verify is None else verify,
80-
follow_redirects=follow_redirects,
81-
http2=http2,
82-
proxy=proxies if proxies is not None else _get_proxies(),
83-
)
75+
proxy_value = proxies if proxies is not None else _get_proxies()
76+
77+
# Try with 'proxy' first (older httpx versions)
78+
try:
79+
return httpx.Client(
80+
headers=_default_headers(headers),
81+
cookies=cookies,
82+
timeout=timeout if timeout is not None else _get_timeout(),
83+
verify=_get_verify() if verify is None else verify,
84+
follow_redirects=follow_redirects,
85+
http2=http2,
86+
proxy=proxy_value,
87+
)
88+
89+
except TypeError:
90+
# Fall back to 'proxies' (newer httpx versions >= 0.24.0)
91+
return httpx.Client(
92+
headers=_default_headers(headers),
93+
cookies=cookies,
94+
timeout=timeout if timeout is not None else _get_timeout(),
95+
verify=_get_verify() if verify is None else verify,
96+
follow_redirects=follow_redirects,
97+
http2=http2,
98+
proxies=proxy_value,
99+
)
84100

85101

86102
def create_async_client(
@@ -94,15 +110,31 @@ def create_async_client(
94110
follow_redirects: bool = True,
95111
) -> httpx.AsyncClient:
96112
"""Factory for a configured httpx.AsyncClient."""
97-
return httpx.AsyncClient(
98-
headers=_default_headers(headers),
99-
cookies=cookies,
100-
timeout=timeout if timeout is not None else _get_timeout(),
101-
verify=_get_verify() if verify is None else verify,
102-
follow_redirects=follow_redirects,
103-
http2=http2,
104-
proxies=proxies if proxies is not None else _get_proxies(),
105-
)
113+
proxy_value = proxies if proxies is not None else _get_proxies()
114+
115+
# Try with 'proxy' first (older httpx versions)
116+
try:
117+
return httpx.AsyncClient(
118+
headers=_default_headers(headers),
119+
cookies=cookies,
120+
timeout=timeout if timeout is not None else _get_timeout(),
121+
verify=_get_verify() if verify is None else verify,
122+
follow_redirects=follow_redirects,
123+
http2=http2,
124+
proxy=proxy_value,
125+
)
126+
127+
except TypeError:
128+
# Fall back to 'proxies' (newer httpx versions >= 0.24.0)
129+
return httpx.AsyncClient(
130+
headers=_default_headers(headers),
131+
cookies=cookies,
132+
timeout=timeout if timeout is not None else _get_timeout(),
133+
verify=_get_verify() if verify is None else verify,
134+
follow_redirects=follow_redirects,
135+
http2=http2,
136+
proxies=proxy_value,
137+
)
106138

107139

108140
def create_client_curl(
@@ -226,4 +258,4 @@ async def async_fetch(
226258
break
227259
# Use same backoff logic for async by sleeping in thread (short duration)
228260
_sleep_with_backoff(attempt)
229-
return None
261+
return None

0 commit comments

Comments
 (0)