fix: pass cookies via Cookie header for cross-domain compatibility
This commit is contained in:
parent
e5aad83837
commit
e09e3e5e38
Binary file not shown.
@ -80,7 +80,7 @@ class KworkClient:
|
||||
Рекомендуется использовать `async with` для корректного освобождения ресурсов.
|
||||
"""
|
||||
|
||||
BASE_URL = "https://kwork.ru"
|
||||
BASE_URL = "https://api.kwork.ru"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -308,10 +308,14 @@ class KworkClient:
|
||||
# Add session token to cookies (slrememberme is the session token)
|
||||
self._cookies["slrememberme"] = self._token
|
||||
|
||||
# Convert cookies to Cookie header string for cross-domain compatibility
|
||||
if self._cookies:
|
||||
cookie_header = "; ".join(f"{k}={v}" for k, v in self._cookies.items())
|
||||
headers["Cookie"] = cookie_header
|
||||
|
||||
self._client = httpx.AsyncClient(
|
||||
base_url=self.base_url,
|
||||
headers=headers,
|
||||
cookies=self._cookies,
|
||||
timeout=self.timeout,
|
||||
http2=True,
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user