fix: use kwork.ru instead of api.kwork.ru (cookies domain match)
This commit is contained in:
parent
9e36db3691
commit
44f6f2e213
@ -2,41 +2,60 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 3,
|
||||
"id": "f28552f1-618c-4853-92e2-566554a2de2c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"True"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import asyncio\n",
|
||||
"from kwork_api import KworkClient\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"import logging\n",
|
||||
"import os\n",
|
||||
"from kwork_api import KworkClient\n",
|
||||
"\n",
|
||||
"load_dotenv('tests/e2e/.env')"
|
||||
"# Включить логирование\n",
|
||||
"logging.basicConfig(level=logging.DEBUG) # или INFO для меньшего шума\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 4,
|
||||
"id": "953d142e-a575-41b7-927d-8cd1546d2747",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"INFO:kwork_api.client:Login request: POST https://kwork.ru/api/user/login (user: None)\n",
|
||||
"DEBUG:kwork_api.client:Login payload: {'l_username': None, 'l_password': None, 'jlog': 1, 'recaptcha_pass_token': '', 'track_client_id': False, 'smart-token': '', 'l_remember_me': '1'}\n",
|
||||
"DEBUG:httpcore.connection:connect_tcp.started host='kwork.ru' port=443 local_address=None timeout=30.0 socket_options=None\n",
|
||||
"DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x7ed01d0f09b0>\n",
|
||||
"DEBUG:httpcore.connection:start_tls.started ssl_context=<ssl.SSLContext object at 0x7ed01ce32150> server_hostname='kwork.ru' timeout=30.0\n",
|
||||
"DEBUG:httpcore.connection:start_tls.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x7ed03c1122d0>\n",
|
||||
"DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'POST']>\n",
|
||||
"DEBUG:httpcore.http11:send_request_headers.complete\n",
|
||||
"DEBUG:httpcore.http11:send_request_body.started request=<Request [b'POST']>\n",
|
||||
"DEBUG:httpcore.http11:send_request_body.complete\n",
|
||||
"DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'POST']>\n",
|
||||
"DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Server', b'QRATOR'), (b'Date', b'Sun, 29 Mar 2026 22:14:13 GMT'), (b'Content-Type', b'application/json'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'Keep-Alive', b'timeout=15'), (b'Vary', b'Accept-Encoding, User-Agent'), (b'Content-Security-Policy', b\"frame-ancestors 'self' https://webvisor.com https://awards.ratingruneta.ru\"), (b'Set-Cookie', b'referrer_url=https%3A%2F%2Fkwork.ru%2F; expires=Sun, 05-Apr-2026 22:14:13 GMT; Max-Age=604800; path=/; secure; HttpOnly; SameSite=None'), (b'Cache-Control', b'no-cache, private'), (b'Strict-Transport-Security', b'max-age=15552000'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Encoding', b'gzip')])\n",
|
||||
"INFO:httpx:HTTP Request: POST https://kwork.ru/api/user/login \"HTTP/1.1 200 OK\"\n",
|
||||
"DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'POST']>\n",
|
||||
"DEBUG:httpcore.http11:receive_response_body.complete\n",
|
||||
"DEBUG:httpcore.http11:response_closed.started\n",
|
||||
"DEBUG:httpcore.http11:response_closed.complete\n",
|
||||
"DEBUG:kwork_api.client:Login response status: 200\n",
|
||||
"DEBUG:kwork_api.client:Login response headers: {'server': 'QRATOR', 'date': 'Sun, 29 Mar 2026 22:14:13 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'keep-alive': 'timeout=15', 'vary': 'Accept-Encoding, User-Agent', 'content-security-policy': \"frame-ancestors 'self' https://webvisor.com https://awards.ratingruneta.ru\", 'set-cookie': 'referrer_url=https%3A%2F%2Fkwork.ru%2F; expires=Sun, 05-Apr-2026 22:14:13 GMT; Max-Age=604800; path=/; secure; HttpOnly; SameSite=None', 'cache-control': 'no-cache, private', 'strict-transport-security': 'max-age=15552000', 'x-content-type-options': 'nosniff', 'content-encoding': 'gzip'}\n",
|
||||
"INFO:kwork_api.client:Login successful: user_id=None, csrf_token=N/A\n",
|
||||
"DEBUG:kwork_api.client:Login response data: {'success': False, 'error': 'Нужно ввести логин', 'redirect': '', 'recaptcha_show': False, 'error_code': 109}\n",
|
||||
"DEBUG:kwork_api.client:Login cookies: ['referrer_url']\n",
|
||||
"DEBUG:httpcore.connection:close.started\n",
|
||||
"DEBUG:httpcore.connection:close.complete\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"KworkAuthError: Login failed: 404\n"
|
||||
"KworkAuthError: Login failed: no userId in cookies. Response: {'success': False, 'error': 'Нужно ввести логин', 'redirect': '', 'recaptcha_show': False, 'error_code': 109}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@ -80,7 +80,7 @@ class KworkClient:
|
||||
Рекомендуется использовать `async with` для корректного освобождения ресурсов.
|
||||
"""
|
||||
|
||||
BASE_URL = "https://api.kwork.ru"
|
||||
BASE_URL = "https://kwork.ru"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user