diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45ddf0a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +site/ diff --git a/docs/api-reference.md b/docs/api-reference.md index 0f3aa8b..89642a1 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -1,487 +1,25 @@ # API Reference -Auto-generated API documentation. +Auto-generated API documentation using mkdocstrings. -Last updated: kwork-api +## Client ---- +::: kwork_api.client.KworkClient -## KworkClient +## Models -Kwork.ru API client. +::: kwork_api.models.Kwork -Usage: - # Login with credentials - client = await KworkClient.login("username", "password") - - # Or restore from token - client = KworkClient(token="your_web_auth_token") - - # Make requests - catalog = await client.catalog.get_list(page=1) +::: kwork_api.models.KworkDetails -### Methods +::: kwork_api.models.Project -#### `catalog()` +::: kwork_api.models.CatalogResponse -Catalog API. +## Errors -#### `projects()` +::: kwork_api.errors.KworkError -Projects API. +::: kwork_api.errors.KworkAuthError -#### `user()` - -User API. - -#### `reference()` - -Reference data API. - -#### `notifications()` - -Notifications API. - -#### `other()` - -Other endpoints. - - ---- - -## CatalogAPI - -Catalog/Kworks API endpoints. - ---- - -## ProjectsAPI - -Projects (freelance orders) API endpoints. - ---- - -## UserAPI - -User API endpoints. - ---- - -## ReferenceAPI - -Reference data (cities, countries, etc.) endpoints. - ---- - -## NotificationsAPI - -Notifications and messages endpoints. - ---- - -## OtherAPI - -Other API endpoints. - ---- - - -# Models - -Pydantic models used in API responses. - -## KworkUser - -User information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `username` | - | - | -| `avatar_url` | - | - | -| `is_online` | - | - | -| `rating` | - | - | - ---- - -## KworkCategory - -Category information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `slug` | - | - | -| `parent_id` | - | - | - ---- - -## Kwork - -Kwork (service) information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `title` | - | - | -| `description` | - | - | -| `price` | - | - | -| `currency` | - | - | -| `category_id` | - | - | -| `seller` | - | - | -| `images` | - | - | -| `rating` | - | - | -| `reviews_count` | - | - | -| `created_at` | - | - | -| `updated_at` | - | - | - ---- - -## KworkDetails - -Extended kwork details. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `full_description` | - | - | -| `requirements` | - | - | -| `delivery_time` | - | - | -| `revisions` | - | - | -| `features` | - | - | -| `faq` | - | - | - ---- - -## PaginationInfo - -Pagination metadata. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `current_page` | - | - | -| `total_pages` | - | - | -| `total_items` | - | - | -| `items_per_page` | - | - | -| `has_next` | - | - | -| `has_prev` | - | - | - ---- - -## CatalogResponse - -Catalog response with kworks and pagination. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `kworks` | - | - | -| `pagination` | - | - | -| `filters` | - | - | -| `sort_options` | - | - | - ---- - -## Project - -Project (freelance order) information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `title` | - | - | -| `description` | - | - | -| `budget` | - | - | -| `budget_type` | - | - | -| `category_id` | - | - | -| `customer` | - | - | -| `status` | - | - | -| `created_at` | - | - | -| `updated_at` | - | - | -| `bids_count` | - | - | -| `skills` | - | - | - ---- - -## ProjectsResponse - -Projects list response. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `projects` | - | - | -| `pagination` | - | - | - ---- - -## Review - -Review information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `rating` | - | - | -| `comment` | - | - | -| `author` | - | - | -| `kwork_id` | - | - | -| `created_at` | - | - | - ---- - -## ReviewsResponse - -Reviews list response. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `reviews` | - | - | -| `pagination` | - | - | -| `average_rating` | - | - | - ---- - -## Notification - -Notification information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `type` | - | - | -| `title` | - | - | -| `message` | - | - | -| `is_read` | - | - | -| `created_at` | - | - | -| `link` | - | - | - ---- - -## NotificationsResponse - -Notifications list response. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `notifications` | - | - | -| `unread_count` | - | - | - ---- - -## Dialog - -Dialog (chat) information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `participant` | - | - | -| `last_message` | - | - | -| `unread_count` | - | - | -| `updated_at` | - | - | - ---- - -## AuthResponse - -Authentication response. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `success` | - | - | -| `user_id` | - | - | -| `username` | - | - | -| `web_auth_token` | - | - | -| `message` | - | - | - ---- - -## ErrorDetail - -Error detail from API. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `code` | - | - | -| `message` | - | - | -| `field` | - | - | - ---- - -## APIErrorResponse - -Standard API error response. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `success` | - | - | -| `errors` | - | - | -| `message` | - | - | - ---- - -## City - -City information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `country_id` | - | - | - ---- - -## Country - -Country information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `code` | - | - | -| `cities` | - | - | - ---- - -## TimeZone - -Timezone information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `offset` | - | - | - ---- - -## Feature - -Feature/addon information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `description` | - | - | -| `price` | - | - | -| `type` | - | - | - ---- - -## Badge - -User badge information. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `id` | - | - | -| `name` | - | - | -| `description` | - | - | -| `icon_url` | - | - | - ---- - -## DataResponse - -Generic data response wrapper. - -### Fields - -| Field | Type | Description | -|-------|------|-------------| -| `success` | - | - | -| `data` | - | - | -| `message` | - | - | - ---- - - -# Errors - -Exception classes for error handling. - -## KworkError - -Base exception for all Kwork API errors. - ---- - -## KworkAuthError - -Authentication/authorization error. - ---- - -## KworkApiError - -API request error (4xx, 5xx). - ---- - -## KworkNotFoundError - -Resource not found (404). - ---- - -## KworkRateLimitError - -Rate limit exceeded (429). - ---- - -## KworkValidationError - -Validation error (400). - ---- - -## KworkNetworkError - -Network/connection error. - ---- +::: kwork_api.errors.KworkApiError diff --git a/docs/api/client.md b/docs/api/client.md new file mode 100644 index 0000000..7cf4af9 --- /dev/null +++ b/docs/api/client.md @@ -0,0 +1,7 @@ +# Client API + +::: kwork_api.client.KworkClient + options: + show_root_heading: true + show_source: true + merge_init_into_class: true diff --git a/docs/api/client/apierrorresponse.md b/docs/api/client/apierrorresponse.md deleted file mode 100644 index b6793e2..0000000 --- a/docs/api/client/apierrorresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# APIErrorResponse - -Standard API error response. diff --git a/docs/api/client/authresponse.md b/docs/api/client/authresponse.md deleted file mode 100644 index 4fbdf9b..0000000 --- a/docs/api/client/authresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# AuthResponse - -Authentication response. diff --git a/docs/api/client/badge.md b/docs/api/client/badge.md deleted file mode 100644 index 39ebed8..0000000 --- a/docs/api/client/badge.md +++ /dev/null @@ -1,3 +0,0 @@ -# Badge - -User badge information. diff --git a/docs/api/client/catalogresponse.md b/docs/api/client/catalogresponse.md deleted file mode 100644 index 383bce6..0000000 --- a/docs/api/client/catalogresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# CatalogResponse - -Catalog response with kworks and pagination. diff --git a/docs/api/client/city.md b/docs/api/client/city.md deleted file mode 100644 index e5a044c..0000000 --- a/docs/api/client/city.md +++ /dev/null @@ -1,3 +0,0 @@ -# City - -City information. diff --git a/docs/api/client/country.md b/docs/api/client/country.md deleted file mode 100644 index dfcd9bc..0000000 --- a/docs/api/client/country.md +++ /dev/null @@ -1,3 +0,0 @@ -# Country - -Country information. diff --git a/docs/api/client/dataresponse.md b/docs/api/client/dataresponse.md deleted file mode 100644 index 6b3f844..0000000 --- a/docs/api/client/dataresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# DataResponse - -Generic data response wrapper. diff --git a/docs/api/client/dialog.md b/docs/api/client/dialog.md deleted file mode 100644 index ec6df2b..0000000 --- a/docs/api/client/dialog.md +++ /dev/null @@ -1,3 +0,0 @@ -# Dialog - -Dialog (chat) information. diff --git a/docs/api/client/feature.md b/docs/api/client/feature.md deleted file mode 100644 index 2a3e800..0000000 --- a/docs/api/client/feature.md +++ /dev/null @@ -1,3 +0,0 @@ -# Feature - -Feature/addon information. diff --git a/docs/api/client/index.md b/docs/api/client/index.md deleted file mode 100644 index 22a9d2a..0000000 --- a/docs/api/client/index.md +++ /dev/null @@ -1,33 +0,0 @@ -# client - -Kwork API Client. - -Main client class with authentication and all API endpoints. - -## Classes - -- [KworkApiError](kworkapierror.md) -- [KworkAuthError](kworkautherror.md) -- [KworkError](kworkerror.md) -- [KworkNetworkError](kworknetworkerror.md) -- [KworkNotFoundError](kworknotfounderror.md) -- [KworkRateLimitError](kworkratelimiterror.md) -- [KworkValidationError](kworkvalidationerror.md) -- [APIErrorResponse](apierrorresponse.md) -- [AuthResponse](authresponse.md) -- [Badge](badge.md) -- [CatalogResponse](catalogresponse.md) -- [City](city.md) -- [Country](country.md) -- [DataResponse](dataresponse.md) -- [Dialog](dialog.md) -- [Feature](feature.md) -- [Kwork](kwork.md) -- [KworkDetails](kworkdetails.md) -- [NotificationsResponse](notificationsresponse.md) -- [Project](project.md) -- [ProjectsResponse](projectsresponse.md) -- [Review](review.md) -- [ReviewsResponse](reviewsresponse.md) -- [TimeZone](timezone.md) -- [KworkClient](kworkclient.md) diff --git a/docs/api/client/kwork.md b/docs/api/client/kwork.md deleted file mode 100644 index f17d3dd..0000000 --- a/docs/api/client/kwork.md +++ /dev/null @@ -1,3 +0,0 @@ -# Kwork - -Kwork (service) information. diff --git a/docs/api/client/kworkapierror.md b/docs/api/client/kworkapierror.md deleted file mode 100644 index 8613c6f..0000000 --- a/docs/api/client/kworkapierror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkApiError - -API request error (4xx, 5xx). diff --git a/docs/api/client/kworkautherror.md b/docs/api/client/kworkautherror.md deleted file mode 100644 index 57e4bb0..0000000 --- a/docs/api/client/kworkautherror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkAuthError - -Authentication/authorization error. diff --git a/docs/api/client/kworkclient.md b/docs/api/client/kworkclient.md deleted file mode 100644 index a935655..0000000 --- a/docs/api/client/kworkclient.md +++ /dev/null @@ -1,36 +0,0 @@ -# KworkClient - -Kwork.ru API client. - -Usage: - # Login with credentials - client = await KworkClient.login("username", "password") - - # Or restore from token - client = KworkClient(token="your_web_auth_token") - - # Make requests - catalog = await client.catalog.get_list(page=1) - -## Methods - -### `login(username: str, password: str, timeout: float = 30.0)` - -Login with username and password. - -Args: - username: Kwork username or email - password: Kwork password - timeout: Request timeout - -Returns: - Authenticated KworkClient instance - -Raises: - KworkAuthError: If login fails - - -### `close()` - -Close HTTP client. - diff --git a/docs/api/client/kworkdetails.md b/docs/api/client/kworkdetails.md deleted file mode 100644 index 4ffbcd9..0000000 --- a/docs/api/client/kworkdetails.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkDetails - -Extended kwork details. diff --git a/docs/api/client/kworkerror.md b/docs/api/client/kworkerror.md deleted file mode 100644 index 2dc1019..0000000 --- a/docs/api/client/kworkerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkError - -Base exception for all Kwork API errors. diff --git a/docs/api/client/kworknetworkerror.md b/docs/api/client/kworknetworkerror.md deleted file mode 100644 index e31a5ca..0000000 --- a/docs/api/client/kworknetworkerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkNetworkError - -Network/connection error. diff --git a/docs/api/client/kworknotfounderror.md b/docs/api/client/kworknotfounderror.md deleted file mode 100644 index 7573ae6..0000000 --- a/docs/api/client/kworknotfounderror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkNotFoundError - -Resource not found (404). diff --git a/docs/api/client/kworkratelimiterror.md b/docs/api/client/kworkratelimiterror.md deleted file mode 100644 index f31f9da..0000000 --- a/docs/api/client/kworkratelimiterror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkRateLimitError - -Rate limit exceeded (429). diff --git a/docs/api/client/kworkvalidationerror.md b/docs/api/client/kworkvalidationerror.md deleted file mode 100644 index df80479..0000000 --- a/docs/api/client/kworkvalidationerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkValidationError - -Validation error (400). diff --git a/docs/api/client/notificationsresponse.md b/docs/api/client/notificationsresponse.md deleted file mode 100644 index 88276cd..0000000 --- a/docs/api/client/notificationsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# NotificationsResponse - -Notifications list response. diff --git a/docs/api/client/project.md b/docs/api/client/project.md deleted file mode 100644 index 11db98c..0000000 --- a/docs/api/client/project.md +++ /dev/null @@ -1,3 +0,0 @@ -# Project - -Project (freelance order) information. diff --git a/docs/api/client/projectsresponse.md b/docs/api/client/projectsresponse.md deleted file mode 100644 index d21a450..0000000 --- a/docs/api/client/projectsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# ProjectsResponse - -Projects list response. diff --git a/docs/api/client/review.md b/docs/api/client/review.md deleted file mode 100644 index 6efd379..0000000 --- a/docs/api/client/review.md +++ /dev/null @@ -1,3 +0,0 @@ -# Review - -Review information. diff --git a/docs/api/client/reviewsresponse.md b/docs/api/client/reviewsresponse.md deleted file mode 100644 index dd27b1f..0000000 --- a/docs/api/client/reviewsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# ReviewsResponse - -Reviews list response. diff --git a/docs/api/client/timezone.md b/docs/api/client/timezone.md deleted file mode 100644 index db82888..0000000 --- a/docs/api/client/timezone.md +++ /dev/null @@ -1,3 +0,0 @@ -# TimeZone - -Timezone information. diff --git a/docs/api/errors.md b/docs/api/errors.md new file mode 100644 index 0000000..a12e5f5 --- /dev/null +++ b/docs/api/errors.md @@ -0,0 +1,23 @@ +# Errors + +Exception classes for error handling. + +## KworkError + +::: kwork_api.errors.KworkError + +## KworkAuthError + +::: kwork_api.errors.KworkAuthError + +## KworkApiError + +::: kwork_api.errors.KworkApiError + +## KworkNotFoundError + +::: kwork_api.errors.KworkNotFoundError + +## KworkRateLimitError + +::: kwork_api.errors.KworkRateLimitError diff --git a/docs/api/errors/index.md b/docs/api/errors/index.md deleted file mode 100644 index 576fe92..0000000 --- a/docs/api/errors/index.md +++ /dev/null @@ -1,15 +0,0 @@ -# errors - -Kwork API exceptions. - -All exceptions provide clear error messages for debugging. - -## Classes - -- [KworkError](kworkerror.md) -- [KworkAuthError](kworkautherror.md) -- [KworkApiError](kworkapierror.md) -- [KworkNotFoundError](kworknotfounderror.md) -- [KworkRateLimitError](kworkratelimiterror.md) -- [KworkValidationError](kworkvalidationerror.md) -- [KworkNetworkError](kworknetworkerror.md) diff --git a/docs/api/errors/kworkapierror.md b/docs/api/errors/kworkapierror.md deleted file mode 100644 index 8613c6f..0000000 --- a/docs/api/errors/kworkapierror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkApiError - -API request error (4xx, 5xx). diff --git a/docs/api/errors/kworkautherror.md b/docs/api/errors/kworkautherror.md deleted file mode 100644 index 57e4bb0..0000000 --- a/docs/api/errors/kworkautherror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkAuthError - -Authentication/authorization error. diff --git a/docs/api/errors/kworkerror.md b/docs/api/errors/kworkerror.md deleted file mode 100644 index 2dc1019..0000000 --- a/docs/api/errors/kworkerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkError - -Base exception for all Kwork API errors. diff --git a/docs/api/errors/kworknetworkerror.md b/docs/api/errors/kworknetworkerror.md deleted file mode 100644 index e31a5ca..0000000 --- a/docs/api/errors/kworknetworkerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkNetworkError - -Network/connection error. diff --git a/docs/api/errors/kworknotfounderror.md b/docs/api/errors/kworknotfounderror.md deleted file mode 100644 index 7573ae6..0000000 --- a/docs/api/errors/kworknotfounderror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkNotFoundError - -Resource not found (404). diff --git a/docs/api/errors/kworkratelimiterror.md b/docs/api/errors/kworkratelimiterror.md deleted file mode 100644 index f31f9da..0000000 --- a/docs/api/errors/kworkratelimiterror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkRateLimitError - -Rate limit exceeded (429). diff --git a/docs/api/errors/kworkvalidationerror.md b/docs/api/errors/kworkvalidationerror.md deleted file mode 100644 index df80479..0000000 --- a/docs/api/errors/kworkvalidationerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkValidationError - -Validation error (400). diff --git a/docs/api/index.md b/docs/api/index.md deleted file mode 100644 index e30f7f7..0000000 --- a/docs/api/index.md +++ /dev/null @@ -1,24 +0,0 @@ -# kwork_api - -Kwork.ru API Client - -Unofficial Python client for Kwork.ru API. - -Example: - from kwork_api import KworkClient - - # Login with credentials - client = await KworkClient.login("username", "password") - - # Or restore from token - client = KworkClient(token="your_web_auth_token") - - # Get catalog - catalog = await client.catalog.get_list(page=1) - -## Classes - -- [KworkClient](kworkclient.md) -- [KworkError](kworkerror.md) -- [KworkAuthError](kworkautherror.md) -- [KworkApiError](kworkapierror.md) diff --git a/docs/api/kworkapierror.md b/docs/api/kworkapierror.md deleted file mode 100644 index 8613c6f..0000000 --- a/docs/api/kworkapierror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkApiError - -API request error (4xx, 5xx). diff --git a/docs/api/kworkautherror.md b/docs/api/kworkautherror.md deleted file mode 100644 index 57e4bb0..0000000 --- a/docs/api/kworkautherror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkAuthError - -Authentication/authorization error. diff --git a/docs/api/kworkclient.md b/docs/api/kworkclient.md deleted file mode 100644 index a935655..0000000 --- a/docs/api/kworkclient.md +++ /dev/null @@ -1,36 +0,0 @@ -# KworkClient - -Kwork.ru API client. - -Usage: - # Login with credentials - client = await KworkClient.login("username", "password") - - # Or restore from token - client = KworkClient(token="your_web_auth_token") - - # Make requests - catalog = await client.catalog.get_list(page=1) - -## Methods - -### `login(username: str, password: str, timeout: float = 30.0)` - -Login with username and password. - -Args: - username: Kwork username or email - password: Kwork password - timeout: Request timeout - -Returns: - Authenticated KworkClient instance - -Raises: - KworkAuthError: If login fails - - -### `close()` - -Close HTTP client. - diff --git a/docs/api/kworkerror.md b/docs/api/kworkerror.md deleted file mode 100644 index 2dc1019..0000000 --- a/docs/api/kworkerror.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkError - -Base exception for all Kwork API errors. diff --git a/docs/api/models.md b/docs/api/models.md new file mode 100644 index 0000000..99cebfb --- /dev/null +++ b/docs/api/models.md @@ -0,0 +1,23 @@ +# Models + +Pydantic models used in API responses. + +## Kwork + +::: kwork_api.models.Kwork + +## KworkDetails + +::: kwork_api.models.KworkDetails + +## Project + +::: kwork_api.models.Project + +## CatalogResponse + +::: kwork_api.models.CatalogResponse + +## PaginationInfo + +::: kwork_api.models.PaginationInfo diff --git a/docs/api/models/apierrorresponse.md b/docs/api/models/apierrorresponse.md deleted file mode 100644 index b6793e2..0000000 --- a/docs/api/models/apierrorresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# APIErrorResponse - -Standard API error response. diff --git a/docs/api/models/authresponse.md b/docs/api/models/authresponse.md deleted file mode 100644 index 4fbdf9b..0000000 --- a/docs/api/models/authresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# AuthResponse - -Authentication response. diff --git a/docs/api/models/badge.md b/docs/api/models/badge.md deleted file mode 100644 index 39ebed8..0000000 --- a/docs/api/models/badge.md +++ /dev/null @@ -1,3 +0,0 @@ -# Badge - -User badge information. diff --git a/docs/api/models/catalogresponse.md b/docs/api/models/catalogresponse.md deleted file mode 100644 index 383bce6..0000000 --- a/docs/api/models/catalogresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# CatalogResponse - -Catalog response with kworks and pagination. diff --git a/docs/api/models/city.md b/docs/api/models/city.md deleted file mode 100644 index e5a044c..0000000 --- a/docs/api/models/city.md +++ /dev/null @@ -1,3 +0,0 @@ -# City - -City information. diff --git a/docs/api/models/country.md b/docs/api/models/country.md deleted file mode 100644 index dfcd9bc..0000000 --- a/docs/api/models/country.md +++ /dev/null @@ -1,3 +0,0 @@ -# Country - -Country information. diff --git a/docs/api/models/dataresponse.md b/docs/api/models/dataresponse.md deleted file mode 100644 index 6b3f844..0000000 --- a/docs/api/models/dataresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# DataResponse - -Generic data response wrapper. diff --git a/docs/api/models/dialog.md b/docs/api/models/dialog.md deleted file mode 100644 index ec6df2b..0000000 --- a/docs/api/models/dialog.md +++ /dev/null @@ -1,3 +0,0 @@ -# Dialog - -Dialog (chat) information. diff --git a/docs/api/models/errordetail.md b/docs/api/models/errordetail.md deleted file mode 100644 index 068cd3c..0000000 --- a/docs/api/models/errordetail.md +++ /dev/null @@ -1,3 +0,0 @@ -# ErrorDetail - -Error detail from API. diff --git a/docs/api/models/feature.md b/docs/api/models/feature.md deleted file mode 100644 index 2a3e800..0000000 --- a/docs/api/models/feature.md +++ /dev/null @@ -1,3 +0,0 @@ -# Feature - -Feature/addon information. diff --git a/docs/api/models/index.md b/docs/api/models/index.md deleted file mode 100644 index e8acd01..0000000 --- a/docs/api/models/index.md +++ /dev/null @@ -1,30 +0,0 @@ -# models - -Pydantic models for Kwork API responses. - -All models follow the structure found in the HAR dump analysis. - -## Classes - -- [KworkUser](kworkuser.md) -- [KworkCategory](kworkcategory.md) -- [Kwork](kwork.md) -- [KworkDetails](kworkdetails.md) -- [PaginationInfo](paginationinfo.md) -- [CatalogResponse](catalogresponse.md) -- [Project](project.md) -- [ProjectsResponse](projectsresponse.md) -- [Review](review.md) -- [ReviewsResponse](reviewsresponse.md) -- [Notification](notification.md) -- [NotificationsResponse](notificationsresponse.md) -- [Dialog](dialog.md) -- [AuthResponse](authresponse.md) -- [ErrorDetail](errordetail.md) -- [APIErrorResponse](apierrorresponse.md) -- [City](city.md) -- [Country](country.md) -- [TimeZone](timezone.md) -- [Feature](feature.md) -- [Badge](badge.md) -- [DataResponse](dataresponse.md) diff --git a/docs/api/models/kwork.md b/docs/api/models/kwork.md deleted file mode 100644 index f17d3dd..0000000 --- a/docs/api/models/kwork.md +++ /dev/null @@ -1,3 +0,0 @@ -# Kwork - -Kwork (service) information. diff --git a/docs/api/models/kworkcategory.md b/docs/api/models/kworkcategory.md deleted file mode 100644 index 4c1ab81..0000000 --- a/docs/api/models/kworkcategory.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkCategory - -Category information. diff --git a/docs/api/models/kworkdetails.md b/docs/api/models/kworkdetails.md deleted file mode 100644 index 4ffbcd9..0000000 --- a/docs/api/models/kworkdetails.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkDetails - -Extended kwork details. diff --git a/docs/api/models/kworkuser.md b/docs/api/models/kworkuser.md deleted file mode 100644 index 0627ce6..0000000 --- a/docs/api/models/kworkuser.md +++ /dev/null @@ -1,3 +0,0 @@ -# KworkUser - -User information. diff --git a/docs/api/models/notification.md b/docs/api/models/notification.md deleted file mode 100644 index 1da4bb9..0000000 --- a/docs/api/models/notification.md +++ /dev/null @@ -1,3 +0,0 @@ -# Notification - -Notification information. diff --git a/docs/api/models/notificationsresponse.md b/docs/api/models/notificationsresponse.md deleted file mode 100644 index 88276cd..0000000 --- a/docs/api/models/notificationsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# NotificationsResponse - -Notifications list response. diff --git a/docs/api/models/paginationinfo.md b/docs/api/models/paginationinfo.md deleted file mode 100644 index 1f73ca8..0000000 --- a/docs/api/models/paginationinfo.md +++ /dev/null @@ -1,3 +0,0 @@ -# PaginationInfo - -Pagination metadata. diff --git a/docs/api/models/project.md b/docs/api/models/project.md deleted file mode 100644 index 11db98c..0000000 --- a/docs/api/models/project.md +++ /dev/null @@ -1,3 +0,0 @@ -# Project - -Project (freelance order) information. diff --git a/docs/api/models/projectsresponse.md b/docs/api/models/projectsresponse.md deleted file mode 100644 index d21a450..0000000 --- a/docs/api/models/projectsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# ProjectsResponse - -Projects list response. diff --git a/docs/api/models/review.md b/docs/api/models/review.md deleted file mode 100644 index 6efd379..0000000 --- a/docs/api/models/review.md +++ /dev/null @@ -1,3 +0,0 @@ -# Review - -Review information. diff --git a/docs/api/models/reviewsresponse.md b/docs/api/models/reviewsresponse.md deleted file mode 100644 index dd27b1f..0000000 --- a/docs/api/models/reviewsresponse.md +++ /dev/null @@ -1,3 +0,0 @@ -# ReviewsResponse - -Reviews list response. diff --git a/docs/api/models/timezone.md b/docs/api/models/timezone.md deleted file mode 100644 index db82888..0000000 --- a/docs/api/models/timezone.md +++ /dev/null @@ -1,3 +0,0 @@ -# TimeZone - -Timezone information. diff --git a/scripts/generate_docs.py b/scripts/generate_docs.py deleted file mode 100644 index d7e6377..0000000 --- a/scripts/generate_docs.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python3 -""" -Generate Markdown API documentation using griffe. - -Usage: - python scripts/generate_docs.py - -Generates docs/api/*.md from source code docstrings. -""" - -import sys -from pathlib import Path - -from griffe import GriffeLoader, ObjectKind - - -def format_signature(obj): - """Format object signature.""" - params = [] - for param in obj.parameters: - if param.name in ("self", "cls"): - continue - p = param.name - if param.annotation: - p += f": {param.annotation}" - if param.default: - p += f" = {param.default}" - params.append(p) - return f"({', '.join(params)})" - - -def generate_class_md(cls, output_path: Path): - """Generate markdown for a class.""" - lines = [ - f"# {cls.name}", - "", - cls.docstring.value if cls.docstring else "", - "", - ] - - # Methods - methods = [m for m in cls.members.values() if m.kind == ObjectKind.FUNCTION and not m.name.startswith("_")] - - if methods: - lines.append("## Methods") - lines.append("") - - for method in methods: - sig = format_signature(method) - lines.append(f"### `{method.name}{sig}`") - lines.append("") - - if method.docstring: - lines.append(method.docstring.value) - lines.append("") - - lines.append("") - - output_path.write_text("\n".join(lines)) - - -def generate_module_md(module, output_dir: Path): - """Generate markdown files for a module.""" - output_dir.mkdir(parents=True, exist_ok=True) - - # Generate index for module - index_path = output_dir / "index.md" - lines = [ - f"# {module.name}", - "", - module.docstring.value if module.docstring else "", - "", - "## Classes", - "", - ] - - for name, obj in module.members.items(): - if obj.kind == ObjectKind.CLASS and not name.startswith("_"): - lines.append(f"- [{name}]({name.lower()}.md)") - # Generate class file - class_path = output_dir / f"{name.lower()}.md" - generate_class_md(obj, class_path) - - lines.append("") - index_path.write_text("\n".join(lines)) - - -def main(): - """Main entry point.""" - root_dir = Path(__file__).parent.parent - src_dir = root_dir / "src" / "kwork_api" - docs_dir = root_dir / "docs" / "api" - - if not src_dir.exists(): - print(f"❌ Source directory not found: {src_dir}") - sys.exit(1) - - print("📝 Loading source code with griffe...") - - # Load with griffe (AST parsing, no code execution) - loader = GriffeLoader(search_paths=[src_dir.parent]) - module = loader.load("kwork_api") - - print("📄 Generating markdown documentation...") - - # Generate for main modules - generate_module_md(module, docs_dir) - - # Generate client.md - if "client" in module.members: - generate_module_md(module["client"], docs_dir / "client") - - # Generate models.md - if "models" in module.members: - generate_module_md(module["models"], docs_dir / "models") - - # Generate errors.md - if "errors" in module.members: - generate_module_md(module["errors"], docs_dir / "errors") - - print(f"✅ Generated markdown in {docs_dir}") - - -if __name__ == "__main__": - main() diff --git a/site/404.html b/site/404.html index 3ce9165..51725bf 100644 --- a/site/404.html +++ b/site/404.html @@ -429,7 +429,7 @@
  • - + @@ -457,7 +457,7 @@
  • - + @@ -485,7 +485,7 @@
  • - + diff --git a/site/api-reference/index.html b/site/api-reference/index.html index 6eae9b1..16f86a1 100644 --- a/site/api-reference/index.html +++ b/site/api-reference/index.html @@ -16,7 +16,7 @@ - + @@ -479,7 +479,18 @@ @@ -660,7 +1360,7 @@
  • - + @@ -688,7 +1388,7 @@
  • - + @@ -716,7 +1416,7 @@
  • - + @@ -792,942 +1492,3121 @@

    API Reference

    -

    Auto-generated API documentation.

    -

    Last updated: kwork-api

    -
    -

    KworkClient

    -

    Kwork.ru API client.

    -

    Usage: - # Login with credentials - client = await KworkClient.login("username", "password")

    -
    # Or restore from token
    -client = KworkClient(token="your_web_auth_token")
    +

    Auto-generated API documentation using mkdocstrings.

    +

    Client

    -# Make requests -catalog = await client.catalog.get_list(page=1) -
    -

    Methods

    -

    catalog()

    -

    Catalog API.

    -

    projects()

    -

    Projects API.

    -

    user()

    -

    User API.

    -

    reference()

    -

    Reference data API.

    -

    notifications()

    -

    Notifications API.

    -

    other()

    -

    Other endpoints.

    -
    -

    CatalogAPI

    -

    Catalog/Kworks API endpoints.

    -
    -

    ProjectsAPI

    -

    Projects (freelance orders) API endpoints.

    -
    -

    UserAPI

    -

    User API endpoints.

    -
    -

    ReferenceAPI

    -

    Reference data (cities, countries, etc.) endpoints.

    -
    -

    NotificationsAPI

    -

    Notifications and messages endpoints.

    -
    -

    OtherAPI

    -

    Other API endpoints.

    -
    -

    Models

    -

    Pydantic models used in API responses.

    -

    KworkUser

    -

    User information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    username--
    avatar_url--
    is_online--
    rating--
    -
    -

    KworkCategory

    -

    Category information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    slug--
    parent_id--
    -
    -

    Kwork

    -

    Kwork (service) information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    title--
    description--
    price--
    currency--
    category_id--
    seller--
    images--
    rating--
    reviews_count--
    created_at--
    updated_at--
    -
    -

    KworkDetails

    -

    Extended kwork details.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    full_description--
    requirements--
    delivery_time--
    revisions--
    features--
    faq--
    -
    -

    PaginationInfo

    -

    Pagination metadata.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    current_page--
    total_pages--
    total_items--
    items_per_page--
    has_next--
    has_prev--
    -
    -

    CatalogResponse

    -

    Catalog response with kworks and pagination.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    kworks--
    pagination--
    filters--
    sort_options--
    -
    -

    Project

    -

    Project (freelance order) information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    title--
    description--
    budget--
    budget_type--
    category_id--
    customer--
    status--
    created_at--
    updated_at--
    bids_count--
    skills--
    -
    -

    ProjectsResponse

    -

    Projects list response.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    projects--
    pagination--
    -
    -

    Review

    -

    Review information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    rating--
    comment--
    author--
    kwork_id--
    created_at--
    -
    -

    ReviewsResponse

    -

    Reviews list response.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    reviews--
    pagination--
    average_rating--
    -
    -

    Notification

    -

    Notification information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    type--
    title--
    message--
    is_read--
    created_at--
    link--
    -
    -

    NotificationsResponse

    -

    Notifications list response.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    notifications--
    unread_count--
    -
    -

    Dialog

    -

    Dialog (chat) information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    participant--
    last_message--
    unread_count--
    updated_at--
    -
    -

    AuthResponse

    -

    Authentication response.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    success--
    user_id--
    username--
    web_auth_token--
    message--
    -
    -

    ErrorDetail

    -

    Error detail from API.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    code--
    message--
    field--
    -
    -

    APIErrorResponse

    -

    Standard API error response.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    success--
    errors--
    message--
    -
    -

    City

    -

    City information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    country_id--
    -
    -

    Country

    -

    Country information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    code--
    cities--
    -
    -

    TimeZone

    -

    Timezone information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    offset--
    -
    -

    Feature

    -

    Feature/addon information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    description--
    price--
    type--
    -
    -

    Badge

    -

    User badge information.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    id--
    name--
    description--
    icon_url--
    -
    -

    DataResponse

    -

    Generic data response wrapper.

    -

    Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldTypeDescription
    success--
    data--
    message--
    -
    -

    Errors

    -

    Exception classes for error handling.

    -

    KworkError

    -

    Base exception for all Kwork API errors.

    -
    -

    KworkAuthError

    -

    Authentication/authorization error.

    -
    -

    KworkApiError

    -

    API request error (4xx, 5xx).

    -
    -

    KworkNotFoundError

    -

    Resource not found (404).

    -
    -

    KworkRateLimitError

    -

    Rate limit exceeded (429).

    -
    -

    KworkValidationError

    -

    Validation error (400).

    -
    -

    KworkNetworkError

    -

    Network/connection error.

    -
    + +
    + + + +

    + kwork_api.client.KworkClient + + +

    +
    KworkClient(
    +    token=None, cookies=None, timeout=30.0, base_url=None
    +)
    +
    + +
    + + + +

    Kwork.ru API client.

    + + +
    + Usage +

    Login with credentials

    +

    client = await KworkClient.login("username", "password")

    +

    Or restore from token

    +

    client = KworkClient(token="your_web_auth_token")

    +

    Make requests

    +

    catalog = await client.catalog.get_list(page=1)

    +
    +

    Initialize client.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + token + + Optional[str] + +
    +

    Web auth token (from getWebAuthToken)

    +
    +
    + None +
    + cookies + + Optional[dict[str, str]] + +
    +

    Session cookies (optional, will be set from token)

    +
    +
    + None +
    + timeout + + float + +
    +

    Request timeout in seconds

    +
    +
    + 30.0 +
    + base_url + + Optional[str] + +
    +

    Custom base URL (for testing)

    +
    +
    + None +
    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    def __init__(
    +    self,
    +    token: Optional[str] = None,
    +    cookies: Optional[dict[str, str]] = None,
    +    timeout: float = 30.0,
    +    base_url: Optional[str] = None,
    +):
    +    """
    +    Initialize client.
    +
    +    Args:
    +        token: Web auth token (from getWebAuthToken)
    +        cookies: Session cookies (optional, will be set from token)
    +        timeout: Request timeout in seconds
    +        base_url: Custom base URL (for testing)
    +    """
    +    self.base_url = base_url or self.BASE_URL
    +    self.timeout = timeout
    +    self._token = token
    +    self._cookies = cookies or {}
    +
    +    # Initialize HTTP client
    +    self._client: Optional[httpx.AsyncClient] = None
    +
    +
    + + + +
    + + + + + +

    Attributes

    + +
    + + + +

    + catalog + + + + property + + +

    +
    catalog
    +
    + +
    + +

    Catalog API.

    + +
    + +
    + +
    + + + +

    + notifications + + + + property + + +

    +
    notifications
    +
    + +
    + +

    Notifications API.

    + +
    + +
    + +
    + + + +

    + other + + + + property + + +

    +
    other
    +
    + +
    + +

    Other endpoints.

    + +
    + +
    + +
    + + + +

    + projects + + + + property + + +

    +
    projects
    +
    + +
    + +

    Projects API.

    + +
    + +
    + +
    + + + +

    + reference + + + + property + + +

    +
    reference
    +
    + +
    + +

    Reference data API.

    + +
    + +
    + +
    + + + +

    + user + + + + property + + +

    +
    user
    +
    + +
    + +

    User API.

    + +
    + +
    + +

    Classes

    + +
    + + + +

    + CatalogAPI + + +

    +
    CatalogAPI(client)
    +
    + +
    + + + +

    Catalog/Kworks API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    266
    +267
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_details + + + + async + + +
    +
    get_details(kwork_id)
    +
    + +
    + +

    Get kwork details.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + kwork_id + + int + +
    +

    Kwork ID

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkDetails + +
    +

    KworkDetails with full information

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    async def get_details(self, kwork_id: int) -> KworkDetails:
    +    """
    +    Get kwork details.
    +
    +    Args:
    +        kwork_id: Kwork ID
    +
    +    Returns:
    +        KworkDetails with full information
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/getKworkDetails",
    +        json={"kwork_id": kwork_id},
    +    )
    +    return KworkDetails.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_details_extra + + + + async + + +
    +
    get_details_extra(kwork_id)
    +
    + +
    + +

    Get additional kwork details.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + kwork_id + + int + +
    +

    Kwork ID

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + dict[str, Any] + +
    +

    Extra details dict

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    async def get_details_extra(self, kwork_id: int) -> dict[str, Any]:
    +    """
    +    Get additional kwork details.
    +
    +    Args:
    +        kwork_id: Kwork ID
    +
    +    Returns:
    +        Extra details dict
    +    """
    +    return await self.client._request(
    +        "POST",
    +        "/getKworkDetailsExtra",
    +        json={"kwork_id": kwork_id},
    +    )
    +
    +
    +
    + +
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list(page=1, category_id=None, sort='recommend')
    +
    + +
    + +

    Get kworks catalog.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + category_id + + Optional[int] + +
    +

    Category filter

    +
    +
    + None +
    + sort + + str + +
    +

    Sort option (recommend, price_asc, price_desc, etc.)

    +
    +
    + 'recommend' +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + CatalogResponse + +
    +

    CatalogResponse with kworks and pagination

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    async def get_list(
    +    self,
    +    page: int = 1,
    +    category_id: Optional[int] = None,
    +    sort: str = "recommend",
    +) -> CatalogResponse:
    +    """
    +    Get kworks catalog.
    +
    +    Args:
    +        page: Page number
    +        category_id: Category filter
    +        sort: Sort option (recommend, price_asc, price_desc, etc.)
    +
    +    Returns:
    +        CatalogResponse with kworks and pagination
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/catalogMainv2",
    +        json={
    +            "page": page,
    +            "category_id": category_id,
    +            "sort": sort,
    +        },
    +    )
    +    return CatalogResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + NotificationsAPI + + +

    +
    NotificationsAPI(client)
    +
    + +
    + + + +

    Notifications and messages endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    475
    +476
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + fetch + + + + async + + +
    +
    fetch()
    +
    + +
    + +

    Fetch new notifications.

    + + +
    + Source code in src/kwork_api/client.py +
    483
    +484
    +485
    +486
    async def fetch(self) -> NotificationsResponse:
    +    """Fetch new notifications."""
    +    data = await self.client._request("POST", "/notificationsFetch")
    +    return NotificationsResponse.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_blocked_dialogs + + + + async + + +
    +
    get_blocked_dialogs()
    +
    + +
    + +

    Get blocked dialogs.

    + + +
    + Source code in src/kwork_api/client.py +
    493
    +494
    +495
    +496
    async def get_blocked_dialogs(self) -> list[Dialog]:
    +    """Get blocked dialogs."""
    +    data = await self.client._request("POST", "/blockedDialogList")
    +    return [Dialog.model_validate(d) for d in data.get("dialogs", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_dialogs + + + + async + + +
    +
    get_dialogs()
    +
    + +
    + +

    Get dialogs list.

    + + +
    + Source code in src/kwork_api/client.py +
    488
    +489
    +490
    +491
    async def get_dialogs(self) -> list[Dialog]:
    +    """Get dialogs list."""
    +    data = await self.client._request("POST", "/dialogs")
    +    return [Dialog.model_validate(d) for d in data.get("dialogs", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list()
    +
    + +
    + +

    Get notifications list.

    + + +
    + Source code in src/kwork_api/client.py +
    478
    +479
    +480
    +481
    async def get_list(self) -> NotificationsResponse:
    +    """Get notifications list."""
    +    data = await self.client._request("POST", "/notifications")
    +    return NotificationsResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + OtherAPI + + +

    +
    OtherAPI(client)
    +
    + +
    + + + +

    Other API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    503
    +504
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_actor + + + + async + + +
    +
    get_actor()
    +
    + +
    + +

    Get actor info.

    + + +
    + Source code in src/kwork_api/client.py +
    565
    +566
    +567
    async def get_actor(self) -> dict[str, Any]:
    +    """Get actor info."""
    +    return await self.client._request("POST", "/actor")
    +
    +
    +
    + +
    + +
    + + +
    + get_channel + + + + async + + +
    +
    get_channel()
    +
    + +
    + +

    Get channel info.

    + + +
    + Source code in src/kwork_api/client.py +
    526
    +527
    +528
    async def get_channel(self) -> dict[str, Any]:
    +    """Get channel info."""
    +    return await self.client._request("POST", "/getChannel")
    +
    +
    +
    + +
    + +
    + + +
    + get_exchange_info + + + + async + + +
    +
    get_exchange_info()
    +
    + +
    + +

    Get exchange info.

    + + +
    + Source code in src/kwork_api/client.py +
    522
    +523
    +524
    async def get_exchange_info(self) -> dict[str, Any]:
    +    """Get exchange info."""
    +    return await self.client._request("POST", "/exchangeInfo")
    +
    +
    +
    + +
    + +
    + + +
    + get_favorite_categories + + + + async + + +
    +
    get_favorite_categories()
    +
    + +
    + +

    Get favorite categories.

    + + +
    + Source code in src/kwork_api/client.py +
    552
    +553
    +554
    +555
    async def get_favorite_categories(self) -> list[int]:
    +    """Get favorite categories."""
    +    data = await self.client._request("POST", "/favoriteCategories")
    +    return data.get("categories", [])
    +
    +
    +
    + +
    + +
    + + +
    + get_in_app_notification + + + + async + + +
    +
    get_in_app_notification()
    +
    + +
    + +

    Get in-app notification.

    + + +
    + Source code in src/kwork_api/client.py +
    530
    +531
    +532
    async def get_in_app_notification(self) -> dict[str, Any]:
    +    """Get in-app notification."""
    +    return await self.client._request("POST", "/getInAppNotification")
    +
    +
    +
    + +
    + +
    + + +
    + get_kworks_status + + + + async + + +
    +
    get_kworks_status()
    +
    + +
    + +

    Get kworks status.

    + + +
    + Source code in src/kwork_api/client.py +
    514
    +515
    +516
    async def get_kworks_status(self) -> dict[str, Any]:
    +    """Get kworks status."""
    +    return await self.client._request("POST", "/kworksStatusList")
    +
    +
    +
    + +
    + +
    + + +
    + get_offers + + + + async + + +
    +
    get_offers()
    +
    + +
    + +

    Get offers.

    + + +
    + Source code in src/kwork_api/client.py +
    518
    +519
    +520
    async def get_offers(self) -> dict[str, Any]:
    +    """Get offers."""
    +    return await self.client._request("POST", "/offers")
    +
    +
    +
    + +
    + +
    + + +
    + get_security_user_data + + + + async + + +
    +
    get_security_user_data()
    +
    + +
    + +

    Get security user data.

    + + +
    + Source code in src/kwork_api/client.py +
    534
    +535
    +536
    async def get_security_user_data(self) -> dict[str, Any]:
    +    """Get security user data."""
    +    return await self.client._request("POST", "/getSecurityUserData")
    +
    +
    +
    + +
    + +
    + + +
    + get_viewed_kworks + + + + async + + +
    +
    get_viewed_kworks()
    +
    + +
    + +

    Get viewed kworks.

    + + +
    + Source code in src/kwork_api/client.py +
    547
    +548
    +549
    +550
    async def get_viewed_kworks(self) -> list[Kwork]:
    +    """Get viewed kworks."""
    +    data = await self.client._request("POST", "/viewedCatalogKworks")
    +    return [Kwork.model_validate(k) for k in data.get("kworks", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_wants + + + + async + + +
    +
    get_wants()
    +
    + +
    + +

    Get user wants.

    + + +
    + Source code in src/kwork_api/client.py +
    506
    +507
    +508
    async def get_wants(self) -> dict[str, Any]:
    +    """Get user wants."""
    +    return await self.client._request("POST", "/myWants")
    +
    +
    +
    + +
    + +
    + + +
    + get_wants_status + + + + async + + +
    +
    get_wants_status()
    +
    + +
    + +

    Get wants status.

    + + +
    + Source code in src/kwork_api/client.py +
    510
    +511
    +512
    async def get_wants_status(self) -> dict[str, Any]:
    +    """Get wants status."""
    +    return await self.client._request("POST", "/wantsStatusList")
    +
    +
    +
    + +
    + +
    + + +
    + go_offline + + + + async + + +
    +
    go_offline()
    +
    + +
    + +

    Set user status to offline.

    + + +
    + Source code in src/kwork_api/client.py +
    561
    +562
    +563
    async def go_offline(self) -> dict[str, Any]:
    +    """Set user status to offline."""
    +    return await self.client._request("POST", "/offline")
    +
    +
    +
    + +
    + +
    + + +
    + is_dialog_allow + + + + async + + +
    +
    is_dialog_allow(user_id)
    +
    + +
    + +

    Check if dialog is allowed.

    + + +
    + Source code in src/kwork_api/client.py +
    538
    +539
    +540
    +541
    +542
    +543
    +544
    +545
    async def is_dialog_allow(self, user_id: int) -> bool:
    +    """Check if dialog is allowed."""
    +    data = await self.client._request(
    +        "POST",
    +        "/isDialogAllow",
    +        json={"user_id": user_id},
    +    )
    +    return data.get("allowed", False)
    +
    +
    +
    + +
    + +
    + + +
    + update_settings + + + + async + + +
    +
    update_settings(settings)
    +
    + +
    + +

    Update user settings.

    + + +
    + Source code in src/kwork_api/client.py +
    557
    +558
    +559
    async def update_settings(self, settings: dict[str, Any]) -> dict[str, Any]:
    +    """Update user settings."""
    +    return await self.client._request("POST", "/updateSettings", json=settings)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + ProjectsAPI + + +

    +
    ProjectsAPI(client)
    +
    + +
    + + + +

    Projects (freelance orders) API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    335
    +336
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list(page=1, category_id=None)
    +
    + +
    + +

    Get projects list.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + category_id + + Optional[int] + +
    +

    Category filter

    +
    +
    + None +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + ProjectsResponse + +
    +

    ProjectsResponse with projects and pagination

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    338
    +339
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +348
    +349
    +350
    +351
    +352
    +353
    +354
    +355
    +356
    +357
    +358
    +359
    +360
    +361
    async def get_list(
    +    self,
    +    page: int = 1,
    +    category_id: Optional[int] = None,
    +) -> ProjectsResponse:
    +    """
    +    Get projects list.
    +
    +    Args:
    +        page: Page number
    +        category_id: Category filter
    +
    +    Returns:
    +        ProjectsResponse with projects and pagination
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/projects",
    +        json={
    +            "page": page,
    +            "category_id": category_id,
    +        },
    +    )
    +    return ProjectsResponse.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_payer_orders + + + + async + + +
    +
    get_payer_orders()
    +
    + +
    + +

    Get orders where user is customer.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Project] + +
    +

    List of projects

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    363
    +364
    +365
    +366
    +367
    +368
    +369
    +370
    +371
    async def get_payer_orders(self) -> list[Project]:
    +    """
    +    Get orders where user is customer.
    +
    +    Returns:
    +        List of projects
    +    """
    +    data = await self.client._request("POST", "/payerOrders")
    +    return [Project.model_validate(p) for p in data.get("orders", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_worker_orders + + + + async + + +
    +
    get_worker_orders()
    +
    + +
    + +

    Get orders where user is performer.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Project] + +
    +

    List of projects

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    373
    +374
    +375
    +376
    +377
    +378
    +379
    +380
    +381
    async def get_worker_orders(self) -> list[Project]:
    +    """
    +    Get orders where user is performer.
    +
    +    Returns:
    +        List of projects
    +    """
    +    data = await self.client._request("POST", "/workerOrders")
    +    return [Project.model_validate(p) for p in data.get("orders", [])]
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + ReferenceAPI + + +

    +
    ReferenceAPI(client)
    +
    + +
    + + + +

    Reference data (cities, countries, etc.) endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    437
    +438
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_badges_info + + + + async + + +
    +
    get_badges_info()
    +
    + +
    + +

    Get badges info.

    + + +
    + Source code in src/kwork_api/client.py +
    465
    +466
    +467
    +468
    async def get_badges_info(self) -> list[Badge]:
    +    """Get badges info."""
    +    data = await self.client._request("POST", "/getBadgesInfo")
    +    return [Badge.model_validate(b) for b in data.get("badges", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_cities + + + + async + + +
    +
    get_cities()
    +
    + +
    + +

    Get all cities.

    + + +
    + Source code in src/kwork_api/client.py +
    440
    +441
    +442
    +443
    async def get_cities(self) -> list[City]:
    +    """Get all cities."""
    +    data = await self.client._request("POST", "/cities")
    +    return [City.model_validate(c) for c in data.get("cities", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_countries + + + + async + + +
    +
    get_countries()
    +
    + +
    + +

    Get all countries.

    + + +
    + Source code in src/kwork_api/client.py +
    445
    +446
    +447
    +448
    async def get_countries(self) -> list[Country]:
    +    """Get all countries."""
    +    data = await self.client._request("POST", "/countries")
    +    return [Country.model_validate(c) for c in data.get("countries", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_features + + + + async + + +
    +
    get_features()
    +
    + +
    + +

    Get available features.

    + + +
    + Source code in src/kwork_api/client.py +
    455
    +456
    +457
    +458
    async def get_features(self) -> list[Feature]:
    +    """Get available features."""
    +    data = await self.client._request("POST", "/getAvailableFeatures")
    +    return [Feature.model_validate(f) for f in data.get("features", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_public_features + + + + async + + +
    +
    get_public_features()
    +
    + +
    + +

    Get public features.

    + + +
    + Source code in src/kwork_api/client.py +
    460
    +461
    +462
    +463
    async def get_public_features(self) -> list[Feature]:
    +    """Get public features."""
    +    data = await self.client._request("POST", "/getPublicFeatures")
    +    return [Feature.model_validate(f) for f in data.get("features", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_timezones + + + + async + + +
    +
    get_timezones()
    +
    + +
    + +

    Get all timezones.

    + + +
    + Source code in src/kwork_api/client.py +
    450
    +451
    +452
    +453
    async def get_timezones(self) -> list[TimeZone]:
    +    """Get all timezones."""
    +    data = await self.client._request("POST", "/timezones")
    +    return [TimeZone.model_validate(t) for t in data.get("timezones", [])]
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + UserAPI + + +

    +
    UserAPI(client)
    +
    + +
    + + + +

    User API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    388
    +389
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_favorite_kworks + + + + async + + +
    +
    get_favorite_kworks()
    +
    + +
    + +

    Get favorite kworks.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Kwork] + +
    +

    List of kworks

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    422
    +423
    +424
    +425
    +426
    +427
    +428
    +429
    +430
    async def get_favorite_kworks(self) -> list[Kwork]:
    +    """
    +    Get favorite kworks.
    +
    +    Returns:
    +        List of kworks
    +    """
    +    data = await self.client._request("POST", "/favoriteKworks")
    +    return [Kwork.model_validate(k) for k in data.get("kworks", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_info + + + + async + + +
    +
    get_info()
    +
    + +
    + +

    Get current user info.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + dict[str, Any] + +
    +

    User info dict

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    391
    +392
    +393
    +394
    +395
    +396
    +397
    +398
    async def get_info(self) -> dict[str, Any]:
    +    """
    +    Get current user info.
    +
    +    Returns:
    +        User info dict
    +    """
    +    return await self.client._request("POST", "/user")
    +
    +
    +
    + +
    + +
    + + +
    + get_reviews + + + + async + + +
    +
    get_reviews(user_id=None, page=1)
    +
    + +
    + +

    Get user reviews.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + user_id + + Optional[int] + +
    +

    User ID (None for current user)

    +
    +
    + None +
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + ReviewsResponse + +
    +

    ReviewsResponse

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    400
    +401
    +402
    +403
    +404
    +405
    +406
    +407
    +408
    +409
    +410
    +411
    +412
    +413
    +414
    +415
    +416
    +417
    +418
    +419
    +420
    async def get_reviews(
    +    self,
    +    user_id: Optional[int] = None,
    +    page: int = 1,
    +) -> ReviewsResponse:
    +    """
    +    Get user reviews.
    +
    +    Args:
    +        user_id: User ID (None for current user)
    +        page: Page number
    +
    +    Returns:
    +        ReviewsResponse
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/userReviews",
    +        json={"user_id": user_id, "page": page},
    +    )
    +    return ReviewsResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    +

    Functions

    + +
    + + +

    + close + + + + async + + +

    +
    close()
    +
    + +
    + +

    Close HTTP client.

    + + +
    + Source code in src/kwork_api/client.py +
    179
    +180
    +181
    +182
    async def close(self) -> None:
    +    """Close HTTP client."""
    +    if self._client and not self._client.is_closed:
    +        await self._client.aclose()
    +
    +
    +
    + +
    + +
    + + +

    + login + + + + async + classmethod + + +

    +
    login(username, password, timeout=30.0)
    +
    + +
    + +

    Login with username and password.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + username + + str + +
    +

    Kwork username or email

    +
    +
    + required +
    + password + + str + +
    +

    Kwork password

    +
    +
    + required +
    + timeout + + float + +
    +

    Request timeout

    +
    +
    + 30.0 +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkClient + +
    +

    Authenticated KworkClient instance

    +
    +
    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkAuthError + +
    +

    If login fails

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
     88
    + 89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    @classmethod
    +async def login(
    +    cls,
    +    username: str,
    +    password: str,
    +    timeout: float = 30.0,
    +) -> "KworkClient":
    +    """
    +    Login with username and password.
    +
    +    Args:
    +        username: Kwork username or email
    +        password: Kwork password
    +        timeout: Request timeout
    +
    +    Returns:
    +        Authenticated KworkClient instance
    +
    +    Raises:
    +        KworkAuthError: If login fails
    +    """
    +    client = cls(timeout=timeout)
    +
    +    try:
    +        async with client._get_httpx_client() as http_client:
    +            # Step 1: Login to get session cookies
    +            login_data = {
    +                "login_or_email": username,
    +                "password": password,
    +            }
    +
    +            response = await http_client.post(
    +                cls.LOGIN_URL,
    +                data=login_data,
    +                headers={"Referer": "https://kwork.ru/"},
    +            )
    +
    +            if response.status_code != 200:
    +                raise KworkAuthError(f"Login failed: {response.status_code}")
    +
    +            # Extract cookies
    +            cookies = dict(response.cookies)
    +
    +            if "userId" not in cookies:
    +                raise KworkAuthError("Login failed: no userId in cookies")
    +
    +            # Step 2: Get web auth token
    +            token_response = await http_client.post(
    +                cls.TOKEN_URL,
    +                json={},
    +            )
    +
    +            if token_response.status_code != 200:
    +                raise KworkAuthError(f"Token request failed: {token_response.status_code}")
    +
    +            token_data = token_response.json()
    +            web_token = token_data.get("web_auth_token")
    +
    +            if not web_token:
    +                raise KworkAuthError("No web_auth_token in response")
    +
    +            # Create new client with token
    +            return cls(token=web_token, cookies=cookies, timeout=timeout)
    +
    +    except httpx.RequestError as e:
    +        raise KworkNetworkError(f"Login request failed: {e}")
    +
    +
    +
    + +
    + + + +
    + +
    + +

    Models

    + + +
    + + + +

    + kwork_api.models.Kwork + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Kwork (service) information.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + +

    + kwork_api.models.KworkDetails + + +

    + + +
    +

    + Bases: Kwork

    + + + +

    Extended kwork details.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + +

    + kwork_api.models.Project + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Project (freelance order) information.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + +

    + kwork_api.models.CatalogResponse + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Catalog response with kworks and pagination.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +

    Errors

    + + +
    + + + +

    + kwork_api.errors.KworkError + + +

    +
    KworkError(message, response=None)
    +
    + +
    +

    + Bases: Exception

    + + + +

    Base exception for all Kwork API errors.

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    13
    +14
    +15
    +16
    def __init__(self, message: str, response: Optional[Any] = None):
    +    self.message = message
    +    self.response = response
    +    super().__init__(self.message)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + +

    + kwork_api.errors.KworkAuthError + + +

    +
    KworkAuthError(
    +    message="Authentication failed", response=None
    +)
    +
    + +
    +

    + Bases: KworkError

    + + + +

    Authentication/authorization error.

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    25
    +26
    def __init__(self, message: str = "Authentication failed", response: Optional[Any] = None):
    +    super().__init__(message, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + +

    + kwork_api.errors.KworkApiError + + +

    +
    KworkApiError(message, status_code=None, response=None)
    +
    + +
    +

    + Bases: KworkError

    + + + +

    API request error (4xx, 5xx).

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    def __init__(
    +    self,
    +    message: str,
    +    status_code: Optional[int] = None,
    +    response: Optional[Any] = None,
    +):
    +    self.status_code = status_code
    +    super().__init__(message, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +
    diff --git a/site/api/client/index.html b/site/api/client/index.html new file mode 100644 index 0000000..925abc3 --- /dev/null +++ b/site/api/client/index.html @@ -0,0 +1,4174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Client - Kwork API + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + +
    + + +
    + +
    + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + + + + + + +
    +
    +
    + + + + +
    + +
    + + + + + + + + +

    Client API

    + + +
    + + + +

    + kwork_api.client.KworkClient + + +

    +
    KworkClient(
    +    token=None, cookies=None, timeout=30.0, base_url=None
    +)
    +
    + +
    + + + +

    Kwork.ru API client.

    + + +
    + Usage +

    Login with credentials

    +

    client = await KworkClient.login("username", "password")

    +

    Or restore from token

    +

    client = KworkClient(token="your_web_auth_token")

    +

    Make requests

    +

    catalog = await client.catalog.get_list(page=1)

    +
    +

    Initialize client.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + token + + Optional[str] + +
    +

    Web auth token (from getWebAuthToken)

    +
    +
    + None +
    + cookies + + Optional[dict[str, str]] + +
    +

    Session cookies (optional, will be set from token)

    +
    +
    + None +
    + timeout + + float + +
    +

    Request timeout in seconds

    +
    +
    + 30.0 +
    + base_url + + Optional[str] + +
    +

    Custom base URL (for testing)

    +
    +
    + None +
    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    def __init__(
    +    self,
    +    token: Optional[str] = None,
    +    cookies: Optional[dict[str, str]] = None,
    +    timeout: float = 30.0,
    +    base_url: Optional[str] = None,
    +):
    +    """
    +    Initialize client.
    +
    +    Args:
    +        token: Web auth token (from getWebAuthToken)
    +        cookies: Session cookies (optional, will be set from token)
    +        timeout: Request timeout in seconds
    +        base_url: Custom base URL (for testing)
    +    """
    +    self.base_url = base_url or self.BASE_URL
    +    self.timeout = timeout
    +    self._token = token
    +    self._cookies = cookies or {}
    +
    +    # Initialize HTTP client
    +    self._client: Optional[httpx.AsyncClient] = None
    +
    +
    + + + +
    + + + + + +

    Attributes

    + +
    + + + +

    + catalog + + + + property + + +

    +
    catalog
    +
    + +
    + +

    Catalog API.

    + +
    + +
    + +
    + + + +

    + notifications + + + + property + + +

    +
    notifications
    +
    + +
    + +

    Notifications API.

    + +
    + +
    + +
    + + + +

    + other + + + + property + + +

    +
    other
    +
    + +
    + +

    Other endpoints.

    + +
    + +
    + +
    + + + +

    + projects + + + + property + + +

    +
    projects
    +
    + +
    + +

    Projects API.

    + +
    + +
    + +
    + + + +

    + reference + + + + property + + +

    +
    reference
    +
    + +
    + +

    Reference data API.

    + +
    + +
    + +
    + + + +

    + user + + + + property + + +

    +
    user
    +
    + +
    + +

    User API.

    + +
    + +
    + +

    Classes

    + +
    + + + +

    + CatalogAPI + + +

    +
    CatalogAPI(client)
    +
    + +
    + + + +

    Catalog/Kworks API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    266
    +267
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_details + + + + async + + +
    +
    get_details(kwork_id)
    +
    + +
    + +

    Get kwork details.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + kwork_id + + int + +
    +

    Kwork ID

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkDetails + +
    +

    KworkDetails with full information

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    async def get_details(self, kwork_id: int) -> KworkDetails:
    +    """
    +    Get kwork details.
    +
    +    Args:
    +        kwork_id: Kwork ID
    +
    +    Returns:
    +        KworkDetails with full information
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/getKworkDetails",
    +        json={"kwork_id": kwork_id},
    +    )
    +    return KworkDetails.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_details_extra + + + + async + + +
    +
    get_details_extra(kwork_id)
    +
    + +
    + +

    Get additional kwork details.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + kwork_id + + int + +
    +

    Kwork ID

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + dict[str, Any] + +
    +

    Extra details dict

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    async def get_details_extra(self, kwork_id: int) -> dict[str, Any]:
    +    """
    +    Get additional kwork details.
    +
    +    Args:
    +        kwork_id: Kwork ID
    +
    +    Returns:
    +        Extra details dict
    +    """
    +    return await self.client._request(
    +        "POST",
    +        "/getKworkDetailsExtra",
    +        json={"kwork_id": kwork_id},
    +    )
    +
    +
    +
    + +
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list(page=1, category_id=None, sort='recommend')
    +
    + +
    + +

    Get kworks catalog.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + category_id + + Optional[int] + +
    +

    Category filter

    +
    +
    + None +
    + sort + + str + +
    +

    Sort option (recommend, price_asc, price_desc, etc.)

    +
    +
    + 'recommend' +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + CatalogResponse + +
    +

    CatalogResponse with kworks and pagination

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    async def get_list(
    +    self,
    +    page: int = 1,
    +    category_id: Optional[int] = None,
    +    sort: str = "recommend",
    +) -> CatalogResponse:
    +    """
    +    Get kworks catalog.
    +
    +    Args:
    +        page: Page number
    +        category_id: Category filter
    +        sort: Sort option (recommend, price_asc, price_desc, etc.)
    +
    +    Returns:
    +        CatalogResponse with kworks and pagination
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/catalogMainv2",
    +        json={
    +            "page": page,
    +            "category_id": category_id,
    +            "sort": sort,
    +        },
    +    )
    +    return CatalogResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + NotificationsAPI + + +

    +
    NotificationsAPI(client)
    +
    + +
    + + + +

    Notifications and messages endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    475
    +476
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + fetch + + + + async + + +
    +
    fetch()
    +
    + +
    + +

    Fetch new notifications.

    + + +
    + Source code in src/kwork_api/client.py +
    483
    +484
    +485
    +486
    async def fetch(self) -> NotificationsResponse:
    +    """Fetch new notifications."""
    +    data = await self.client._request("POST", "/notificationsFetch")
    +    return NotificationsResponse.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_blocked_dialogs + + + + async + + +
    +
    get_blocked_dialogs()
    +
    + +
    + +

    Get blocked dialogs.

    + + +
    + Source code in src/kwork_api/client.py +
    493
    +494
    +495
    +496
    async def get_blocked_dialogs(self) -> list[Dialog]:
    +    """Get blocked dialogs."""
    +    data = await self.client._request("POST", "/blockedDialogList")
    +    return [Dialog.model_validate(d) for d in data.get("dialogs", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_dialogs + + + + async + + +
    +
    get_dialogs()
    +
    + +
    + +

    Get dialogs list.

    + + +
    + Source code in src/kwork_api/client.py +
    488
    +489
    +490
    +491
    async def get_dialogs(self) -> list[Dialog]:
    +    """Get dialogs list."""
    +    data = await self.client._request("POST", "/dialogs")
    +    return [Dialog.model_validate(d) for d in data.get("dialogs", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list()
    +
    + +
    + +

    Get notifications list.

    + + +
    + Source code in src/kwork_api/client.py +
    478
    +479
    +480
    +481
    async def get_list(self) -> NotificationsResponse:
    +    """Get notifications list."""
    +    data = await self.client._request("POST", "/notifications")
    +    return NotificationsResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + OtherAPI + + +

    +
    OtherAPI(client)
    +
    + +
    + + + +

    Other API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    503
    +504
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_actor + + + + async + + +
    +
    get_actor()
    +
    + +
    + +

    Get actor info.

    + + +
    + Source code in src/kwork_api/client.py +
    565
    +566
    +567
    async def get_actor(self) -> dict[str, Any]:
    +    """Get actor info."""
    +    return await self.client._request("POST", "/actor")
    +
    +
    +
    + +
    + +
    + + +
    + get_channel + + + + async + + +
    +
    get_channel()
    +
    + +
    + +

    Get channel info.

    + + +
    + Source code in src/kwork_api/client.py +
    526
    +527
    +528
    async def get_channel(self) -> dict[str, Any]:
    +    """Get channel info."""
    +    return await self.client._request("POST", "/getChannel")
    +
    +
    +
    + +
    + +
    + + +
    + get_exchange_info + + + + async + + +
    +
    get_exchange_info()
    +
    + +
    + +

    Get exchange info.

    + + +
    + Source code in src/kwork_api/client.py +
    522
    +523
    +524
    async def get_exchange_info(self) -> dict[str, Any]:
    +    """Get exchange info."""
    +    return await self.client._request("POST", "/exchangeInfo")
    +
    +
    +
    + +
    + +
    + + +
    + get_favorite_categories + + + + async + + +
    +
    get_favorite_categories()
    +
    + +
    + +

    Get favorite categories.

    + + +
    + Source code in src/kwork_api/client.py +
    552
    +553
    +554
    +555
    async def get_favorite_categories(self) -> list[int]:
    +    """Get favorite categories."""
    +    data = await self.client._request("POST", "/favoriteCategories")
    +    return data.get("categories", [])
    +
    +
    +
    + +
    + +
    + + +
    + get_in_app_notification + + + + async + + +
    +
    get_in_app_notification()
    +
    + +
    + +

    Get in-app notification.

    + + +
    + Source code in src/kwork_api/client.py +
    530
    +531
    +532
    async def get_in_app_notification(self) -> dict[str, Any]:
    +    """Get in-app notification."""
    +    return await self.client._request("POST", "/getInAppNotification")
    +
    +
    +
    + +
    + +
    + + +
    + get_kworks_status + + + + async + + +
    +
    get_kworks_status()
    +
    + +
    + +

    Get kworks status.

    + + +
    + Source code in src/kwork_api/client.py +
    514
    +515
    +516
    async def get_kworks_status(self) -> dict[str, Any]:
    +    """Get kworks status."""
    +    return await self.client._request("POST", "/kworksStatusList")
    +
    +
    +
    + +
    + +
    + + +
    + get_offers + + + + async + + +
    +
    get_offers()
    +
    + +
    + +

    Get offers.

    + + +
    + Source code in src/kwork_api/client.py +
    518
    +519
    +520
    async def get_offers(self) -> dict[str, Any]:
    +    """Get offers."""
    +    return await self.client._request("POST", "/offers")
    +
    +
    +
    + +
    + +
    + + +
    + get_security_user_data + + + + async + + +
    +
    get_security_user_data()
    +
    + +
    + +

    Get security user data.

    + + +
    + Source code in src/kwork_api/client.py +
    534
    +535
    +536
    async def get_security_user_data(self) -> dict[str, Any]:
    +    """Get security user data."""
    +    return await self.client._request("POST", "/getSecurityUserData")
    +
    +
    +
    + +
    + +
    + + +
    + get_viewed_kworks + + + + async + + +
    +
    get_viewed_kworks()
    +
    + +
    + +

    Get viewed kworks.

    + + +
    + Source code in src/kwork_api/client.py +
    547
    +548
    +549
    +550
    async def get_viewed_kworks(self) -> list[Kwork]:
    +    """Get viewed kworks."""
    +    data = await self.client._request("POST", "/viewedCatalogKworks")
    +    return [Kwork.model_validate(k) for k in data.get("kworks", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_wants + + + + async + + +
    +
    get_wants()
    +
    + +
    + +

    Get user wants.

    + + +
    + Source code in src/kwork_api/client.py +
    506
    +507
    +508
    async def get_wants(self) -> dict[str, Any]:
    +    """Get user wants."""
    +    return await self.client._request("POST", "/myWants")
    +
    +
    +
    + +
    + +
    + + +
    + get_wants_status + + + + async + + +
    +
    get_wants_status()
    +
    + +
    + +

    Get wants status.

    + + +
    + Source code in src/kwork_api/client.py +
    510
    +511
    +512
    async def get_wants_status(self) -> dict[str, Any]:
    +    """Get wants status."""
    +    return await self.client._request("POST", "/wantsStatusList")
    +
    +
    +
    + +
    + +
    + + +
    + go_offline + + + + async + + +
    +
    go_offline()
    +
    + +
    + +

    Set user status to offline.

    + + +
    + Source code in src/kwork_api/client.py +
    561
    +562
    +563
    async def go_offline(self) -> dict[str, Any]:
    +    """Set user status to offline."""
    +    return await self.client._request("POST", "/offline")
    +
    +
    +
    + +
    + +
    + + +
    + is_dialog_allow + + + + async + + +
    +
    is_dialog_allow(user_id)
    +
    + +
    + +

    Check if dialog is allowed.

    + + +
    + Source code in src/kwork_api/client.py +
    538
    +539
    +540
    +541
    +542
    +543
    +544
    +545
    async def is_dialog_allow(self, user_id: int) -> bool:
    +    """Check if dialog is allowed."""
    +    data = await self.client._request(
    +        "POST",
    +        "/isDialogAllow",
    +        json={"user_id": user_id},
    +    )
    +    return data.get("allowed", False)
    +
    +
    +
    + +
    + +
    + + +
    + update_settings + + + + async + + +
    +
    update_settings(settings)
    +
    + +
    + +

    Update user settings.

    + + +
    + Source code in src/kwork_api/client.py +
    557
    +558
    +559
    async def update_settings(self, settings: dict[str, Any]) -> dict[str, Any]:
    +    """Update user settings."""
    +    return await self.client._request("POST", "/updateSettings", json=settings)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + ProjectsAPI + + +

    +
    ProjectsAPI(client)
    +
    + +
    + + + +

    Projects (freelance orders) API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    335
    +336
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_list + + + + async + + +
    +
    get_list(page=1, category_id=None)
    +
    + +
    + +

    Get projects list.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + category_id + + Optional[int] + +
    +

    Category filter

    +
    +
    + None +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + ProjectsResponse + +
    +

    ProjectsResponse with projects and pagination

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    338
    +339
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +348
    +349
    +350
    +351
    +352
    +353
    +354
    +355
    +356
    +357
    +358
    +359
    +360
    +361
    async def get_list(
    +    self,
    +    page: int = 1,
    +    category_id: Optional[int] = None,
    +) -> ProjectsResponse:
    +    """
    +    Get projects list.
    +
    +    Args:
    +        page: Page number
    +        category_id: Category filter
    +
    +    Returns:
    +        ProjectsResponse with projects and pagination
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/projects",
    +        json={
    +            "page": page,
    +            "category_id": category_id,
    +        },
    +    )
    +    return ProjectsResponse.model_validate(data)
    +
    +
    +
    + +
    + +
    + + +
    + get_payer_orders + + + + async + + +
    +
    get_payer_orders()
    +
    + +
    + +

    Get orders where user is customer.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Project] + +
    +

    List of projects

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    363
    +364
    +365
    +366
    +367
    +368
    +369
    +370
    +371
    async def get_payer_orders(self) -> list[Project]:
    +    """
    +    Get orders where user is customer.
    +
    +    Returns:
    +        List of projects
    +    """
    +    data = await self.client._request("POST", "/payerOrders")
    +    return [Project.model_validate(p) for p in data.get("orders", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_worker_orders + + + + async + + +
    +
    get_worker_orders()
    +
    + +
    + +

    Get orders where user is performer.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Project] + +
    +

    List of projects

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    373
    +374
    +375
    +376
    +377
    +378
    +379
    +380
    +381
    async def get_worker_orders(self) -> list[Project]:
    +    """
    +    Get orders where user is performer.
    +
    +    Returns:
    +        List of projects
    +    """
    +    data = await self.client._request("POST", "/workerOrders")
    +    return [Project.model_validate(p) for p in data.get("orders", [])]
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + ReferenceAPI + + +

    +
    ReferenceAPI(client)
    +
    + +
    + + + +

    Reference data (cities, countries, etc.) endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    437
    +438
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_badges_info + + + + async + + +
    +
    get_badges_info()
    +
    + +
    + +

    Get badges info.

    + + +
    + Source code in src/kwork_api/client.py +
    465
    +466
    +467
    +468
    async def get_badges_info(self) -> list[Badge]:
    +    """Get badges info."""
    +    data = await self.client._request("POST", "/getBadgesInfo")
    +    return [Badge.model_validate(b) for b in data.get("badges", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_cities + + + + async + + +
    +
    get_cities()
    +
    + +
    + +

    Get all cities.

    + + +
    + Source code in src/kwork_api/client.py +
    440
    +441
    +442
    +443
    async def get_cities(self) -> list[City]:
    +    """Get all cities."""
    +    data = await self.client._request("POST", "/cities")
    +    return [City.model_validate(c) for c in data.get("cities", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_countries + + + + async + + +
    +
    get_countries()
    +
    + +
    + +

    Get all countries.

    + + +
    + Source code in src/kwork_api/client.py +
    445
    +446
    +447
    +448
    async def get_countries(self) -> list[Country]:
    +    """Get all countries."""
    +    data = await self.client._request("POST", "/countries")
    +    return [Country.model_validate(c) for c in data.get("countries", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_features + + + + async + + +
    +
    get_features()
    +
    + +
    + +

    Get available features.

    + + +
    + Source code in src/kwork_api/client.py +
    455
    +456
    +457
    +458
    async def get_features(self) -> list[Feature]:
    +    """Get available features."""
    +    data = await self.client._request("POST", "/getAvailableFeatures")
    +    return [Feature.model_validate(f) for f in data.get("features", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_public_features + + + + async + + +
    +
    get_public_features()
    +
    + +
    + +

    Get public features.

    + + +
    + Source code in src/kwork_api/client.py +
    460
    +461
    +462
    +463
    async def get_public_features(self) -> list[Feature]:
    +    """Get public features."""
    +    data = await self.client._request("POST", "/getPublicFeatures")
    +    return [Feature.model_validate(f) for f in data.get("features", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_timezones + + + + async + + +
    +
    get_timezones()
    +
    + +
    + +

    Get all timezones.

    + + +
    + Source code in src/kwork_api/client.py +
    450
    +451
    +452
    +453
    async def get_timezones(self) -> list[TimeZone]:
    +    """Get all timezones."""
    +    data = await self.client._request("POST", "/timezones")
    +    return [TimeZone.model_validate(t) for t in data.get("timezones", [])]
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + +
    + + + +

    + UserAPI + + +

    +
    UserAPI(client)
    +
    + +
    + + + +

    User API endpoints.

    + + + + + + + + +
    + Source code in src/kwork_api/client.py +
    388
    +389
    def __init__(self, client: "KworkClient"):
    +    self.client = client
    +
    +
    + + + +
    + + + + + + + + +
    Functions
    + +
    + + +
    + get_favorite_kworks + + + + async + + +
    +
    get_favorite_kworks()
    +
    + +
    + +

    Get favorite kworks.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Kwork] + +
    +

    List of kworks

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    422
    +423
    +424
    +425
    +426
    +427
    +428
    +429
    +430
    async def get_favorite_kworks(self) -> list[Kwork]:
    +    """
    +    Get favorite kworks.
    +
    +    Returns:
    +        List of kworks
    +    """
    +    data = await self.client._request("POST", "/favoriteKworks")
    +    return [Kwork.model_validate(k) for k in data.get("kworks", [])]
    +
    +
    +
    + +
    + +
    + + +
    + get_info + + + + async + + +
    +
    get_info()
    +
    + +
    + +

    Get current user info.

    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + dict[str, Any] + +
    +

    User info dict

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    391
    +392
    +393
    +394
    +395
    +396
    +397
    +398
    async def get_info(self) -> dict[str, Any]:
    +    """
    +    Get current user info.
    +
    +    Returns:
    +        User info dict
    +    """
    +    return await self.client._request("POST", "/user")
    +
    +
    +
    + +
    + +
    + + +
    + get_reviews + + + + async + + +
    +
    get_reviews(user_id=None, page=1)
    +
    + +
    + +

    Get user reviews.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + user_id + + Optional[int] + +
    +

    User ID (None for current user)

    +
    +
    + None +
    + page + + int + +
    +

    Page number

    +
    +
    + 1 +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + ReviewsResponse + +
    +

    ReviewsResponse

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
    400
    +401
    +402
    +403
    +404
    +405
    +406
    +407
    +408
    +409
    +410
    +411
    +412
    +413
    +414
    +415
    +416
    +417
    +418
    +419
    +420
    async def get_reviews(
    +    self,
    +    user_id: Optional[int] = None,
    +    page: int = 1,
    +) -> ReviewsResponse:
    +    """
    +    Get user reviews.
    +
    +    Args:
    +        user_id: User ID (None for current user)
    +        page: Page number
    +
    +    Returns:
    +        ReviewsResponse
    +    """
    +    data = await self.client._request(
    +        "POST",
    +        "/userReviews",
    +        json={"user_id": user_id, "page": page},
    +    )
    +    return ReviewsResponse.model_validate(data)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    +

    Functions

    + +
    + + +

    + close + + + + async + + +

    +
    close()
    +
    + +
    + +

    Close HTTP client.

    + + +
    + Source code in src/kwork_api/client.py +
    179
    +180
    +181
    +182
    async def close(self) -> None:
    +    """Close HTTP client."""
    +    if self._client and not self._client.is_closed:
    +        await self._client.aclose()
    +
    +
    +
    + +
    + +
    + + +

    + login + + + + async + classmethod + + +

    +
    login(username, password, timeout=30.0)
    +
    + +
    + +

    Login with username and password.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + username + + str + +
    +

    Kwork username or email

    +
    +
    + required +
    + password + + str + +
    +

    Kwork password

    +
    +
    + required +
    + timeout + + float + +
    +

    Request timeout

    +
    +
    + 30.0 +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkClient + +
    +

    Authenticated KworkClient instance

    +
    +
    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + KworkAuthError + +
    +

    If login fails

    +
    +
    + + +
    + Source code in src/kwork_api/client.py +
     88
    + 89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    @classmethod
    +async def login(
    +    cls,
    +    username: str,
    +    password: str,
    +    timeout: float = 30.0,
    +) -> "KworkClient":
    +    """
    +    Login with username and password.
    +
    +    Args:
    +        username: Kwork username or email
    +        password: Kwork password
    +        timeout: Request timeout
    +
    +    Returns:
    +        Authenticated KworkClient instance
    +
    +    Raises:
    +        KworkAuthError: If login fails
    +    """
    +    client = cls(timeout=timeout)
    +
    +    try:
    +        async with client._get_httpx_client() as http_client:
    +            # Step 1: Login to get session cookies
    +            login_data = {
    +                "login_or_email": username,
    +                "password": password,
    +            }
    +
    +            response = await http_client.post(
    +                cls.LOGIN_URL,
    +                data=login_data,
    +                headers={"Referer": "https://kwork.ru/"},
    +            )
    +
    +            if response.status_code != 200:
    +                raise KworkAuthError(f"Login failed: {response.status_code}")
    +
    +            # Extract cookies
    +            cookies = dict(response.cookies)
    +
    +            if "userId" not in cookies:
    +                raise KworkAuthError("Login failed: no userId in cookies")
    +
    +            # Step 2: Get web auth token
    +            token_response = await http_client.post(
    +                cls.TOKEN_URL,
    +                json={},
    +            )
    +
    +            if token_response.status_code != 200:
    +                raise KworkAuthError(f"Token request failed: {token_response.status_code}")
    +
    +            token_data = token_response.json()
    +            web_token = token_data.get("web_auth_token")
    +
    +            if not web_token:
    +                raise KworkAuthError("No web_auth_token in response")
    +
    +            # Create new client with token
    +            return cls(token=web_token, cookies=cookies, timeout=timeout)
    +
    +    except httpx.RequestError as e:
    +        raise KworkNetworkError(f"Login request failed: {e}")
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/api/errors/index.html b/site/api/errors/index.html new file mode 100644 index 0000000..19c8c58 --- /dev/null +++ b/site/api/errors/index.html @@ -0,0 +1,1102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Errors - Kwork API + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + +
    + + +
    + +
    + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + + + + + + +
    +
    +
    + + + + +
    + +
    + + + + + + + + +

    Errors

    +

    Exception classes for error handling.

    +

    KworkError

    + + +
    + + + +

    + kwork_api.errors.KworkError + + +

    +
    KworkError(message, response=None)
    +
    + +
    +

    + Bases: Exception

    + + + +

    Base exception for all Kwork API errors.

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    13
    +14
    +15
    +16
    def __init__(self, message: str, response: Optional[Any] = None):
    +    self.message = message
    +    self.response = response
    +    super().__init__(self.message)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +

    KworkAuthError

    + + +
    + + + +

    + kwork_api.errors.KworkAuthError + + +

    +
    KworkAuthError(
    +    message="Authentication failed", response=None
    +)
    +
    + +
    +

    + Bases: KworkError

    + + + +

    Authentication/authorization error.

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    25
    +26
    def __init__(self, message: str = "Authentication failed", response: Optional[Any] = None):
    +    super().__init__(message, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +

    KworkApiError

    + + +
    + + + +

    + kwork_api.errors.KworkApiError + + +

    +
    KworkApiError(message, status_code=None, response=None)
    +
    + +
    +

    + Bases: KworkError

    + + + +

    API request error (4xx, 5xx).

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    def __init__(
    +    self,
    +    message: str,
    +    status_code: Optional[int] = None,
    +    response: Optional[Any] = None,
    +):
    +    self.status_code = status_code
    +    super().__init__(message, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +

    KworkNotFoundError

    + + +
    + + + +

    + kwork_api.errors.KworkNotFoundError + + +

    +
    KworkNotFoundError(resource, response=None)
    +
    + +
    +

    + Bases: KworkApiError

    + + + +

    Resource not found (404).

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    53
    +54
    def __init__(self, resource: str, response: Optional[Any] = None):
    +    super().__init__(f"Resource not found: {resource}", 404, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +

    KworkRateLimitError

    + + +
    + + + +

    + kwork_api.errors.KworkRateLimitError + + +

    +
    KworkRateLimitError(
    +    message="Rate limit exceeded", response=None
    +)
    +
    + +
    +

    + Bases: KworkApiError

    + + + +

    Rate limit exceeded (429).

    + + + + + + + + +
    + Source code in src/kwork_api/errors.py +
    60
    +61
    def __init__(self, message: str = "Rate limit exceeded", response: Optional[Any] = None):
    +    super().__init__(message, 429, response)
    +
    +
    + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/api/models/index.html b/site/api/models/index.html new file mode 100644 index 0000000..35bfc63 --- /dev/null +++ b/site/api/models/index.html @@ -0,0 +1,1042 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models - Kwork API + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + +
    + + +
    + +
    + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + + + + + + +
    +
    +
    + + + + +
    + +
    + + + + + + + + +

    Models

    +

    Pydantic models used in API responses.

    +

    Kwork

    + + +
    + + + +

    + kwork_api.models.Kwork + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Kwork (service) information.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +

    KworkDetails

    + + +
    + + + +

    + kwork_api.models.KworkDetails + + +

    + + +
    +

    + Bases: Kwork

    + + + +

    Extended kwork details.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +

    Project

    + + +
    + + + +

    + kwork_api.models.Project + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Project (freelance order) information.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +

    CatalogResponse

    + + +
    + + + +

    + kwork_api.models.CatalogResponse + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Catalog response with kworks and pagination.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +

    PaginationInfo

    + + +
    + + + +

    + kwork_api.models.PaginationInfo + + +

    + + +
    +

    + Bases: BaseModel

    + + + +

    Pagination metadata.

    + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/examples/index.html b/site/examples/index.html index feda28a..2cc65b6 100644 --- a/site/examples/index.html +++ b/site/examples/index.html @@ -13,7 +13,7 @@ - + @@ -440,7 +440,7 @@
  • - + @@ -468,7 +468,7 @@
  • - + @@ -496,7 +496,7 @@
  • - + diff --git a/site/index.html b/site/index.html index 4acd998..c547971 100644 --- a/site/index.html +++ b/site/index.html @@ -581,7 +581,7 @@
  • - + @@ -609,7 +609,7 @@
  • - + @@ -637,7 +637,7 @@
  • - + diff --git a/site/objects.inv b/site/objects.inv index f411e19..baa2486 100644 Binary files a/site/objects.inv and b/site/objects.inv differ diff --git a/site/search/search_index.json b/site/search/search_index.json index 211ae8a..b7f3400 100644 --- a/site/search/search_index.json +++ b/site/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"Kwork API Documentation","text":"

    Unofficial Python client for Kwork.ru API.

    "},{"location":"#quick-start","title":"Quick Start","text":""},{"location":"#installation","title":"Installation","text":"
    pip install kwork-api\n
    "},{"location":"#authentication","title":"Authentication","text":"
    from kwork_api import KworkClient\n\n# Login with credentials\nclient = await KworkClient.login(\"username\", \"password\")\n\n# Or restore from token\nclient = KworkClient(token=\"your_web_auth_token\")\n
    "},{"location":"#basic-usage","title":"Basic Usage","text":"
    async with KworkClient(token=\"token\") as client:\n    # Get catalog\n    catalog = await client.catalog.get_list(page=1)\n\n    # Get kwork details\n    details = await client.catalog.get_details(kwork_id=123)\n\n    # Get projects\n    projects = await client.projects.get_list()\n
    "},{"location":"#documentation-sections","title":"Documentation Sections","text":""},{"location":"#features","title":"Features","text":""},{"location":"#rate-limiting","title":"Rate Limiting","text":"

    Rate limiting is not implemented in the library. Handle it in your code:

    import asyncio\n\nfor page in range(1, 10):\n    catalog = await client.catalog.get_list(page=page)\n    await asyncio.sleep(1)  # 1 second delay\n
    "},{"location":"#error-handling","title":"Error Handling","text":"
    from kwork_api import KworkAuthError, KworkApiError\n\ntry:\n    catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n    print(f\"Auth failed: {e}\")\nexcept KworkApiError as e:\n    print(f\"API error [{e.status_code}]: {e.message}\")\n

    Documentation auto-generated from source code.

    "},{"location":"api-reference/","title":"API Reference","text":"

    Auto-generated API documentation.

    Last updated: kwork-api

    "},{"location":"api-reference/#kworkclient","title":"KworkClient","text":"

    Kwork.ru API client.

    Usage: # Login with credentials client = await KworkClient.login(\"username\", \"password\")

    # Or restore from token\nclient = KworkClient(token=\"your_web_auth_token\")\n\n# Make requests\ncatalog = await client.catalog.get_list(page=1)\n
    "},{"location":"api-reference/#methods","title":"Methods","text":""},{"location":"api-reference/#catalog","title":"catalog()","text":"

    Catalog API.

    "},{"location":"api-reference/#projects","title":"projects()","text":"

    Projects API.

    "},{"location":"api-reference/#user","title":"user()","text":"

    User API.

    "},{"location":"api-reference/#reference","title":"reference()","text":"

    Reference data API.

    "},{"location":"api-reference/#notifications","title":"notifications()","text":"

    Notifications API.

    "},{"location":"api-reference/#other","title":"other()","text":"

    Other endpoints.

    "},{"location":"api-reference/#catalogapi","title":"CatalogAPI","text":"

    Catalog/Kworks API endpoints.

    "},{"location":"api-reference/#projectsapi","title":"ProjectsAPI","text":"

    Projects (freelance orders) API endpoints.

    "},{"location":"api-reference/#userapi","title":"UserAPI","text":"

    User API endpoints.

    "},{"location":"api-reference/#referenceapi","title":"ReferenceAPI","text":"

    Reference data (cities, countries, etc.) endpoints.

    "},{"location":"api-reference/#notificationsapi","title":"NotificationsAPI","text":"

    Notifications and messages endpoints.

    "},{"location":"api-reference/#otherapi","title":"OtherAPI","text":"

    Other API endpoints.

    "},{"location":"api-reference/#models","title":"Models","text":"

    Pydantic models used in API responses.

    "},{"location":"api-reference/#kworkuser","title":"KworkUser","text":"

    User information.

    "},{"location":"api-reference/#fields","title":"Fields","text":"Field Type Description id - - username - - avatar_url - - is_online - - rating - -"},{"location":"api-reference/#kworkcategory","title":"KworkCategory","text":"

    Category information.

    "},{"location":"api-reference/#fields_1","title":"Fields","text":"Field Type Description id - - name - - slug - - parent_id - -"},{"location":"api-reference/#kwork","title":"Kwork","text":"

    Kwork (service) information.

    "},{"location":"api-reference/#fields_2","title":"Fields","text":"Field Type Description id - - title - - description - - price - - currency - - category_id - - seller - - images - - rating - - reviews_count - - created_at - - updated_at - -"},{"location":"api-reference/#kworkdetails","title":"KworkDetails","text":"

    Extended kwork details.

    "},{"location":"api-reference/#fields_3","title":"Fields","text":"Field Type Description full_description - - requirements - - delivery_time - - revisions - - features - - faq - -"},{"location":"api-reference/#paginationinfo","title":"PaginationInfo","text":"

    Pagination metadata.

    "},{"location":"api-reference/#fields_4","title":"Fields","text":"Field Type Description current_page - - total_pages - - total_items - - items_per_page - - has_next - - has_prev - -"},{"location":"api-reference/#catalogresponse","title":"CatalogResponse","text":"

    Catalog response with kworks and pagination.

    "},{"location":"api-reference/#fields_5","title":"Fields","text":"Field Type Description kworks - - pagination - - filters - - sort_options - -"},{"location":"api-reference/#project","title":"Project","text":"

    Project (freelance order) information.

    "},{"location":"api-reference/#fields_6","title":"Fields","text":"Field Type Description id - - title - - description - - budget - - budget_type - - category_id - - customer - - status - - created_at - - updated_at - - bids_count - - skills - -"},{"location":"api-reference/#projectsresponse","title":"ProjectsResponse","text":"

    Projects list response.

    "},{"location":"api-reference/#fields_7","title":"Fields","text":"Field Type Description projects - - pagination - -"},{"location":"api-reference/#review","title":"Review","text":"

    Review information.

    "},{"location":"api-reference/#fields_8","title":"Fields","text":"Field Type Description id - - rating - - comment - - author - - kwork_id - - created_at - -"},{"location":"api-reference/#reviewsresponse","title":"ReviewsResponse","text":"

    Reviews list response.

    "},{"location":"api-reference/#fields_9","title":"Fields","text":"Field Type Description reviews - - pagination - - average_rating - -"},{"location":"api-reference/#notification","title":"Notification","text":"

    Notification information.

    "},{"location":"api-reference/#fields_10","title":"Fields","text":"Field Type Description id - - type - - title - - message - - is_read - - created_at - - link - -"},{"location":"api-reference/#notificationsresponse","title":"NotificationsResponse","text":"

    Notifications list response.

    "},{"location":"api-reference/#fields_11","title":"Fields","text":"Field Type Description notifications - - unread_count - -"},{"location":"api-reference/#dialog","title":"Dialog","text":"

    Dialog (chat) information.

    "},{"location":"api-reference/#fields_12","title":"Fields","text":"Field Type Description id - - participant - - last_message - - unread_count - - updated_at - -"},{"location":"api-reference/#authresponse","title":"AuthResponse","text":"

    Authentication response.

    "},{"location":"api-reference/#fields_13","title":"Fields","text":"Field Type Description success - - user_id - - username - - web_auth_token - - message - -"},{"location":"api-reference/#errordetail","title":"ErrorDetail","text":"

    Error detail from API.

    "},{"location":"api-reference/#fields_14","title":"Fields","text":"Field Type Description code - - message - - field - -"},{"location":"api-reference/#apierrorresponse","title":"APIErrorResponse","text":"

    Standard API error response.

    "},{"location":"api-reference/#fields_15","title":"Fields","text":"Field Type Description success - - errors - - message - -"},{"location":"api-reference/#city","title":"City","text":"

    City information.

    "},{"location":"api-reference/#fields_16","title":"Fields","text":"Field Type Description id - - name - - country_id - -"},{"location":"api-reference/#country","title":"Country","text":"

    Country information.

    "},{"location":"api-reference/#fields_17","title":"Fields","text":"Field Type Description id - - name - - code - - cities - -"},{"location":"api-reference/#timezone","title":"TimeZone","text":"

    Timezone information.

    "},{"location":"api-reference/#fields_18","title":"Fields","text":"Field Type Description id - - name - - offset - -"},{"location":"api-reference/#feature","title":"Feature","text":"

    Feature/addon information.

    "},{"location":"api-reference/#fields_19","title":"Fields","text":"Field Type Description id - - name - - description - - price - - type - -"},{"location":"api-reference/#badge","title":"Badge","text":"

    User badge information.

    "},{"location":"api-reference/#fields_20","title":"Fields","text":"Field Type Description id - - name - - description - - icon_url - -"},{"location":"api-reference/#dataresponse","title":"DataResponse","text":"

    Generic data response wrapper.

    "},{"location":"api-reference/#fields_21","title":"Fields","text":"Field Type Description success - - data - - message - -"},{"location":"api-reference/#errors","title":"Errors","text":"

    Exception classes for error handling.

    "},{"location":"api-reference/#kworkerror","title":"KworkError","text":"

    Base exception for all Kwork API errors.

    "},{"location":"api-reference/#kworkautherror","title":"KworkAuthError","text":"

    Authentication/authorization error.

    "},{"location":"api-reference/#kworkapierror","title":"KworkApiError","text":"

    API request error (4xx, 5xx).

    "},{"location":"api-reference/#kworknotfounderror","title":"KworkNotFoundError","text":"

    Resource not found (404).

    "},{"location":"api-reference/#kworkratelimiterror","title":"KworkRateLimitError","text":"

    Rate limit exceeded (429).

    "},{"location":"api-reference/#kworkvalidationerror","title":"KworkValidationError","text":"

    Validation error (400).

    "},{"location":"api-reference/#kworknetworkerror","title":"KworkNetworkError","text":"

    Network/connection error.

    "},{"location":"examples/","title":"Usage Examples","text":""},{"location":"examples/#catalog","title":"Catalog","text":""},{"location":"examples/#get-catalog-list","title":"Get Catalog List","text":"
    from kwork_api import KworkClient\n\nasync with KworkClient(token=\"token\") as client:\n    catalog = await client.catalog.get_list(page=1, category_id=5)\n\n    for kwork in catalog.kworks:\n        print(f\"{kwork.title}: {kwork.price} RUB\")\n\n    # Pagination\n    if catalog.pagination:\n        print(f\"Page {catalog.pagination.current_page} of {catalog.pagination.total_pages}\")\n
    "},{"location":"examples/#get-kwork-details","title":"Get Kwork Details","text":"
    details = await client.catalog.get_details(kwork_id=123)\n\nprint(f\"Title: {details.title}\")\nprint(f\"Price: {details.price}\")\nprint(f\"Description: {details.full_description}\")\nprint(f\"Delivery: {details.delivery_time} days\")\n
    "},{"location":"examples/#projects","title":"Projects","text":""},{"location":"examples/#get-projects-list","title":"Get Projects List","text":"
    projects = await client.projects.get_list(page=1)\n\nfor project in projects.projects:\n    print(f\"{project.title} - {project.budget} RUB\")\n
    "},{"location":"examples/#get-customer-orders","title":"Get Customer Orders","text":"
    orders = await client.projects.get_payer_orders()\n\nfor order in orders:\n    print(f\"Order #{order.id}: {order.status}\")\n
    "},{"location":"examples/#get-performer-orders","title":"Get Performer Orders","text":"
    orders = await client.projects.get_worker_orders()\n\nfor order in orders:\n    print(f\"Work #{order.id}: {order.status}\")\n
    "},{"location":"examples/#user","title":"User","text":""},{"location":"examples/#get-user-info","title":"Get User Info","text":"
    user_info = await client.user.get_info()\nprint(f\"Username: {user_info.get('username')}\")\n
    "},{"location":"examples/#get-reviews","title":"Get Reviews","text":"
    reviews = await client.user.get_reviews(page=1)\n\nfor review in reviews.reviews:\n    print(f\"Rating: {review.rating}/5 - {review.comment}\")\n
    "},{"location":"examples/#get-favorite-kworks","title":"Get Favorite Kworks","text":"
    favorites = await client.user.get_favorite_kworks()\n\nfor kwork in favorites:\n    print(f\"Favorite: {kwork.title}\")\n
    "},{"location":"examples/#reference-data","title":"Reference Data","text":""},{"location":"examples/#get-cities","title":"Get Cities","text":"
    cities = await client.reference.get_cities()\n\nfor city in cities:\n    print(f\"{city.id}: {city.name}\")\n
    "},{"location":"examples/#get-countries","title":"Get Countries","text":"
    countries = await client.reference.get_countries()\n\nfor country in countries:\n    print(f\"{country.id}: {country.name}\")\n
    "},{"location":"examples/#get-timezones","title":"Get Timezones","text":"
    timezones = await client.reference.get_timezones()\n\nfor tz in timezones:\n    print(f\"{tz.id}: {tz.name} ({tz.offset})\")\n
    "},{"location":"examples/#notifications","title":"Notifications","text":""},{"location":"examples/#get-notifications","title":"Get Notifications","text":"
    notifications = await client.notifications.get_list()\n\nfor notif in notifications.notifications:\n    print(f\"{notif.title}: {notif.message}\")\n\nprint(f\"Unread: {notifications.unread_count}\")\n
    "},{"location":"examples/#fetch-new-notifications","title":"Fetch New Notifications","text":"
    new_notifications = await client.notifications.fetch()\nprint(f\"New: {len(new_notifications.notifications)}\")\n
    "},{"location":"examples/#get-dialogs","title":"Get Dialogs","text":"
    dialogs = await client.notifications.get_dialogs()\n\nfor dialog in dialogs:\n    print(f\"Dialog with {dialog.participant.username}: {dialog.last_message}\")\n
    "},{"location":"examples/#error-handling","title":"Error Handling","text":"
    from kwork_api import KworkAuthError, KworkApiError, KworkNotFoundError\n\ntry:\n    catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n    print(f\"Authentication failed: {e}\")\nexcept KworkNotFoundError as e:\n    print(f\"Resource not found: {e}\")\nexcept KworkApiError as e:\n    print(f\"API error [{e.status_code}]: {e.message}\")\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n
    "},{"location":"examples/#rate-limiting","title":"Rate Limiting","text":"
    import asyncio\n\nasync def fetch_all_pages():\n    all_kworks = []\n\n    for page in range(1, 10):\n        try:\n            catalog = await client.catalog.get_list(page=page)\n            all_kworks.extend(catalog.kworks)\n\n            if not catalog.pagination or not catalog.pagination.has_next:\n                break\n\n            # Delay to avoid rate limiting\n            await asyncio.sleep(1)\n\n        except KworkRateLimitError:\n            print(\"Rate limited, waiting...\")\n            await asyncio.sleep(5)\n\n    return all_kworks\n
    "},{"location":"examples/#pagination-helper","title":"Pagination Helper","text":"
    async def fetch_all_catalog():\n    \"\"\"Fetch all kworks from catalog with pagination.\"\"\"\n    all_kworks = []\n    page = 1\n\n    while True:\n        catalog = await client.catalog.get_list(page=page)\n        all_kworks.extend(catalog.kworks)\n\n        if not catalog.pagination or not catalog.pagination.has_next:\n            break\n\n        page += 1\n        await asyncio.sleep(0.5)  # Rate limiting\n\n    return all_kworks\n

    More examples in the API Reference.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"Kwork API Documentation","text":"

    Unofficial Python client for Kwork.ru API.

    "},{"location":"#quick-start","title":"Quick Start","text":""},{"location":"#installation","title":"Installation","text":"
    pip install kwork-api\n
    "},{"location":"#authentication","title":"Authentication","text":"
    from kwork_api import KworkClient\n\n# Login with credentials\nclient = await KworkClient.login(\"username\", \"password\")\n\n# Or restore from token\nclient = KworkClient(token=\"your_web_auth_token\")\n
    "},{"location":"#basic-usage","title":"Basic Usage","text":"
    async with KworkClient(token=\"token\") as client:\n    # Get catalog\n    catalog = await client.catalog.get_list(page=1)\n\n    # Get kwork details\n    details = await client.catalog.get_details(kwork_id=123)\n\n    # Get projects\n    projects = await client.projects.get_list()\n
    "},{"location":"#documentation-sections","title":"Documentation Sections","text":""},{"location":"#features","title":"Features","text":""},{"location":"#rate-limiting","title":"Rate Limiting","text":"

    Rate limiting is not implemented in the library. Handle it in your code:

    import asyncio\n\nfor page in range(1, 10):\n    catalog = await client.catalog.get_list(page=page)\n    await asyncio.sleep(1)  # 1 second delay\n
    "},{"location":"#error-handling","title":"Error Handling","text":"
    from kwork_api import KworkAuthError, KworkApiError\n\ntry:\n    catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n    print(f\"Auth failed: {e}\")\nexcept KworkApiError as e:\n    print(f\"API error [{e.status_code}]: {e.message}\")\n

    Documentation auto-generated from source code.

    "},{"location":"api-reference/","title":"API Reference","text":"

    Auto-generated API documentation using mkdocstrings.

    "},{"location":"api-reference/#client","title":"Client","text":""},{"location":"api-reference/#kwork_api.client.KworkClient","title":"kwork_api.client.KworkClient","text":"
    KworkClient(\n    token=None, cookies=None, timeout=30.0, base_url=None\n)\n

    Kwork.ru API client.

    Usage

    Initialize client.

    Parameters:

    Name Type Description Default token Optional[str]

    Web auth token (from getWebAuthToken)

    None cookies Optional[dict[str, str]]

    Session cookies (optional, will be set from token)

    None timeout float

    Request timeout in seconds

    30.0 base_url Optional[str]

    Custom base URL (for testing)

    None Source code in src/kwork_api/client.py
    def __init__(\n    self,\n    token: Optional[str] = None,\n    cookies: Optional[dict[str, str]] = None,\n    timeout: float = 30.0,\n    base_url: Optional[str] = None,\n):\n    \"\"\"\n    Initialize client.\n\n    Args:\n        token: Web auth token (from getWebAuthToken)\n        cookies: Session cookies (optional, will be set from token)\n        timeout: Request timeout in seconds\n        base_url: Custom base URL (for testing)\n    \"\"\"\n    self.base_url = base_url or self.BASE_URL\n    self.timeout = timeout\n    self._token = token\n    self._cookies = cookies or {}\n\n    # Initialize HTTP client\n    self._client: Optional[httpx.AsyncClient] = None\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient--login-with-credentials","title":"Login with credentials","text":"

    client = await KworkClient.login(\"username\", \"password\")

    "},{"location":"api-reference/#kwork_api.client.KworkClient--or-restore-from-token","title":"Or restore from token","text":"

    client = KworkClient(token=\"your_web_auth_token\")

    "},{"location":"api-reference/#kwork_api.client.KworkClient--make-requests","title":"Make requests","text":"

    catalog = await client.catalog.get_list(page=1)

    "},{"location":"api-reference/#kwork_api.client.KworkClient-attributes","title":"Attributes","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.catalog","title":"catalog property","text":"
    catalog\n

    Catalog API.

    "},{"location":"api-reference/#kwork_api.client.KworkClient.notifications","title":"notifications property","text":"
    notifications\n

    Notifications API.

    "},{"location":"api-reference/#kwork_api.client.KworkClient.other","title":"other property","text":"
    other\n

    Other endpoints.

    "},{"location":"api-reference/#kwork_api.client.KworkClient.projects","title":"projects property","text":"
    projects\n

    Projects API.

    "},{"location":"api-reference/#kwork_api.client.KworkClient.reference","title":"reference property","text":"
    reference\n

    Reference data API.

    "},{"location":"api-reference/#kwork_api.client.KworkClient.user","title":"user property","text":"
    user\n

    User API.

    "},{"location":"api-reference/#kwork_api.client.KworkClient-classes","title":"Classes","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.CatalogAPI","title":"CatalogAPI","text":"
    CatalogAPI(client)\n

    Catalog/Kworks API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.CatalogAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.CatalogAPI.get_details","title":"get_details async","text":"
    get_details(kwork_id)\n

    Get kwork details.

    Parameters:

    Name Type Description Default kwork_id int

    Kwork ID

    required

    Returns:

    Type Description KworkDetails

    KworkDetails with full information

    Source code in src/kwork_api/client.py
    async def get_details(self, kwork_id: int) -> KworkDetails:\n    \"\"\"\n    Get kwork details.\n\n    Args:\n        kwork_id: Kwork ID\n\n    Returns:\n        KworkDetails with full information\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/getKworkDetails\",\n        json={\"kwork_id\": kwork_id},\n    )\n    return KworkDetails.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.CatalogAPI.get_details_extra","title":"get_details_extra async","text":"
    get_details_extra(kwork_id)\n

    Get additional kwork details.

    Parameters:

    Name Type Description Default kwork_id int

    Kwork ID

    required

    Returns:

    Type Description dict[str, Any]

    Extra details dict

    Source code in src/kwork_api/client.py
    async def get_details_extra(self, kwork_id: int) -> dict[str, Any]:\n    \"\"\"\n    Get additional kwork details.\n\n    Args:\n        kwork_id: Kwork ID\n\n    Returns:\n        Extra details dict\n    \"\"\"\n    return await self.client._request(\n        \"POST\",\n        \"/getKworkDetailsExtra\",\n        json={\"kwork_id\": kwork_id},\n    )\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.CatalogAPI.get_list","title":"get_list async","text":"
    get_list(page=1, category_id=None, sort='recommend')\n

    Get kworks catalog.

    Parameters:

    Name Type Description Default page int

    Page number

    1 category_id Optional[int]

    Category filter

    None sort str

    Sort option (recommend, price_asc, price_desc, etc.)

    'recommend'

    Returns:

    Type Description CatalogResponse

    CatalogResponse with kworks and pagination

    Source code in src/kwork_api/client.py
    async def get_list(\n    self,\n    page: int = 1,\n    category_id: Optional[int] = None,\n    sort: str = \"recommend\",\n) -> CatalogResponse:\n    \"\"\"\n    Get kworks catalog.\n\n    Args:\n        page: Page number\n        category_id: Category filter\n        sort: Sort option (recommend, price_asc, price_desc, etc.)\n\n    Returns:\n        CatalogResponse with kworks and pagination\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/catalogMainv2\",\n        json={\n            \"page\": page,\n            \"category_id\": category_id,\n            \"sort\": sort,\n        },\n    )\n    return CatalogResponse.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI","title":"NotificationsAPI","text":"
    NotificationsAPI(client)\n

    Notifications and messages endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI.fetch","title":"fetch async","text":"
    fetch()\n

    Fetch new notifications.

    Source code in src/kwork_api/client.py
    async def fetch(self) -> NotificationsResponse:\n    \"\"\"Fetch new notifications.\"\"\"\n    data = await self.client._request(\"POST\", \"/notificationsFetch\")\n    return NotificationsResponse.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI.get_blocked_dialogs","title":"get_blocked_dialogs async","text":"
    get_blocked_dialogs()\n

    Get blocked dialogs.

    Source code in src/kwork_api/client.py
    async def get_blocked_dialogs(self) -> list[Dialog]:\n    \"\"\"Get blocked dialogs.\"\"\"\n    data = await self.client._request(\"POST\", \"/blockedDialogList\")\n    return [Dialog.model_validate(d) for d in data.get(\"dialogs\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI.get_dialogs","title":"get_dialogs async","text":"
    get_dialogs()\n

    Get dialogs list.

    Source code in src/kwork_api/client.py
    async def get_dialogs(self) -> list[Dialog]:\n    \"\"\"Get dialogs list.\"\"\"\n    data = await self.client._request(\"POST\", \"/dialogs\")\n    return [Dialog.model_validate(d) for d in data.get(\"dialogs\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.NotificationsAPI.get_list","title":"get_list async","text":"
    get_list()\n

    Get notifications list.

    Source code in src/kwork_api/client.py
    async def get_list(self) -> NotificationsResponse:\n    \"\"\"Get notifications list.\"\"\"\n    data = await self.client._request(\"POST\", \"/notifications\")\n    return NotificationsResponse.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI","title":"OtherAPI","text":"
    OtherAPI(client)\n

    Other API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_actor","title":"get_actor async","text":"
    get_actor()\n

    Get actor info.

    Source code in src/kwork_api/client.py
    async def get_actor(self) -> dict[str, Any]:\n    \"\"\"Get actor info.\"\"\"\n    return await self.client._request(\"POST\", \"/actor\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_channel","title":"get_channel async","text":"
    get_channel()\n

    Get channel info.

    Source code in src/kwork_api/client.py
    async def get_channel(self) -> dict[str, Any]:\n    \"\"\"Get channel info.\"\"\"\n    return await self.client._request(\"POST\", \"/getChannel\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_exchange_info","title":"get_exchange_info async","text":"
    get_exchange_info()\n

    Get exchange info.

    Source code in src/kwork_api/client.py
    async def get_exchange_info(self) -> dict[str, Any]:\n    \"\"\"Get exchange info.\"\"\"\n    return await self.client._request(\"POST\", \"/exchangeInfo\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_favorite_categories","title":"get_favorite_categories async","text":"
    get_favorite_categories()\n

    Get favorite categories.

    Source code in src/kwork_api/client.py
    async def get_favorite_categories(self) -> list[int]:\n    \"\"\"Get favorite categories.\"\"\"\n    data = await self.client._request(\"POST\", \"/favoriteCategories\")\n    return data.get(\"categories\", [])\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_in_app_notification","title":"get_in_app_notification async","text":"
    get_in_app_notification()\n

    Get in-app notification.

    Source code in src/kwork_api/client.py
    async def get_in_app_notification(self) -> dict[str, Any]:\n    \"\"\"Get in-app notification.\"\"\"\n    return await self.client._request(\"POST\", \"/getInAppNotification\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_kworks_status","title":"get_kworks_status async","text":"
    get_kworks_status()\n

    Get kworks status.

    Source code in src/kwork_api/client.py
    async def get_kworks_status(self) -> dict[str, Any]:\n    \"\"\"Get kworks status.\"\"\"\n    return await self.client._request(\"POST\", \"/kworksStatusList\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_offers","title":"get_offers async","text":"
    get_offers()\n

    Get offers.

    Source code in src/kwork_api/client.py
    async def get_offers(self) -> dict[str, Any]:\n    \"\"\"Get offers.\"\"\"\n    return await self.client._request(\"POST\", \"/offers\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_security_user_data","title":"get_security_user_data async","text":"
    get_security_user_data()\n

    Get security user data.

    Source code in src/kwork_api/client.py
    async def get_security_user_data(self) -> dict[str, Any]:\n    \"\"\"Get security user data.\"\"\"\n    return await self.client._request(\"POST\", \"/getSecurityUserData\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_viewed_kworks","title":"get_viewed_kworks async","text":"
    get_viewed_kworks()\n

    Get viewed kworks.

    Source code in src/kwork_api/client.py
    async def get_viewed_kworks(self) -> list[Kwork]:\n    \"\"\"Get viewed kworks.\"\"\"\n    data = await self.client._request(\"POST\", \"/viewedCatalogKworks\")\n    return [Kwork.model_validate(k) for k in data.get(\"kworks\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_wants","title":"get_wants async","text":"
    get_wants()\n

    Get user wants.

    Source code in src/kwork_api/client.py
    async def get_wants(self) -> dict[str, Any]:\n    \"\"\"Get user wants.\"\"\"\n    return await self.client._request(\"POST\", \"/myWants\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.get_wants_status","title":"get_wants_status async","text":"
    get_wants_status()\n

    Get wants status.

    Source code in src/kwork_api/client.py
    async def get_wants_status(self) -> dict[str, Any]:\n    \"\"\"Get wants status.\"\"\"\n    return await self.client._request(\"POST\", \"/wantsStatusList\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.go_offline","title":"go_offline async","text":"
    go_offline()\n

    Set user status to offline.

    Source code in src/kwork_api/client.py
    async def go_offline(self) -> dict[str, Any]:\n    \"\"\"Set user status to offline.\"\"\"\n    return await self.client._request(\"POST\", \"/offline\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.is_dialog_allow","title":"is_dialog_allow async","text":"
    is_dialog_allow(user_id)\n

    Check if dialog is allowed.

    Source code in src/kwork_api/client.py
    async def is_dialog_allow(self, user_id: int) -> bool:\n    \"\"\"Check if dialog is allowed.\"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/isDialogAllow\",\n        json={\"user_id\": user_id},\n    )\n    return data.get(\"allowed\", False)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.OtherAPI.update_settings","title":"update_settings async","text":"
    update_settings(settings)\n

    Update user settings.

    Source code in src/kwork_api/client.py
    async def update_settings(self, settings: dict[str, Any]) -> dict[str, Any]:\n    \"\"\"Update user settings.\"\"\"\n    return await self.client._request(\"POST\", \"/updateSettings\", json=settings)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ProjectsAPI","title":"ProjectsAPI","text":"
    ProjectsAPI(client)\n

    Projects (freelance orders) API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ProjectsAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.ProjectsAPI.get_list","title":"get_list async","text":"
    get_list(page=1, category_id=None)\n

    Get projects list.

    Parameters:

    Name Type Description Default page int

    Page number

    1 category_id Optional[int]

    Category filter

    None

    Returns:

    Type Description ProjectsResponse

    ProjectsResponse with projects and pagination

    Source code in src/kwork_api/client.py
    async def get_list(\n    self,\n    page: int = 1,\n    category_id: Optional[int] = None,\n) -> ProjectsResponse:\n    \"\"\"\n    Get projects list.\n\n    Args:\n        page: Page number\n        category_id: Category filter\n\n    Returns:\n        ProjectsResponse with projects and pagination\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/projects\",\n        json={\n            \"page\": page,\n            \"category_id\": category_id,\n        },\n    )\n    return ProjectsResponse.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ProjectsAPI.get_payer_orders","title":"get_payer_orders async","text":"
    get_payer_orders()\n

    Get orders where user is customer.

    Returns:

    Type Description list[Project]

    List of projects

    Source code in src/kwork_api/client.py
    async def get_payer_orders(self) -> list[Project]:\n    \"\"\"\n    Get orders where user is customer.\n\n    Returns:\n        List of projects\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/payerOrders\")\n    return [Project.model_validate(p) for p in data.get(\"orders\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ProjectsAPI.get_worker_orders","title":"get_worker_orders async","text":"
    get_worker_orders()\n

    Get orders where user is performer.

    Returns:

    Type Description list[Project]

    List of projects

    Source code in src/kwork_api/client.py
    async def get_worker_orders(self) -> list[Project]:\n    \"\"\"\n    Get orders where user is performer.\n\n    Returns:\n        List of projects\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/workerOrders\")\n    return [Project.model_validate(p) for p in data.get(\"orders\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI","title":"ReferenceAPI","text":"
    ReferenceAPI(client)\n

    Reference data (cities, countries, etc.) endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_badges_info","title":"get_badges_info async","text":"
    get_badges_info()\n

    Get badges info.

    Source code in src/kwork_api/client.py
    async def get_badges_info(self) -> list[Badge]:\n    \"\"\"Get badges info.\"\"\"\n    data = await self.client._request(\"POST\", \"/getBadgesInfo\")\n    return [Badge.model_validate(b) for b in data.get(\"badges\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_cities","title":"get_cities async","text":"
    get_cities()\n

    Get all cities.

    Source code in src/kwork_api/client.py
    async def get_cities(self) -> list[City]:\n    \"\"\"Get all cities.\"\"\"\n    data = await self.client._request(\"POST\", \"/cities\")\n    return [City.model_validate(c) for c in data.get(\"cities\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_countries","title":"get_countries async","text":"
    get_countries()\n

    Get all countries.

    Source code in src/kwork_api/client.py
    async def get_countries(self) -> list[Country]:\n    \"\"\"Get all countries.\"\"\"\n    data = await self.client._request(\"POST\", \"/countries\")\n    return [Country.model_validate(c) for c in data.get(\"countries\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_features","title":"get_features async","text":"
    get_features()\n

    Get available features.

    Source code in src/kwork_api/client.py
    async def get_features(self) -> list[Feature]:\n    \"\"\"Get available features.\"\"\"\n    data = await self.client._request(\"POST\", \"/getAvailableFeatures\")\n    return [Feature.model_validate(f) for f in data.get(\"features\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_public_features","title":"get_public_features async","text":"
    get_public_features()\n

    Get public features.

    Source code in src/kwork_api/client.py
    async def get_public_features(self) -> list[Feature]:\n    \"\"\"Get public features.\"\"\"\n    data = await self.client._request(\"POST\", \"/getPublicFeatures\")\n    return [Feature.model_validate(f) for f in data.get(\"features\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.ReferenceAPI.get_timezones","title":"get_timezones async","text":"
    get_timezones()\n

    Get all timezones.

    Source code in src/kwork_api/client.py
    async def get_timezones(self) -> list[TimeZone]:\n    \"\"\"Get all timezones.\"\"\"\n    data = await self.client._request(\"POST\", \"/timezones\")\n    return [TimeZone.model_validate(t) for t in data.get(\"timezones\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.UserAPI","title":"UserAPI","text":"
    UserAPI(client)\n

    User API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.UserAPI-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.UserAPI.get_favorite_kworks","title":"get_favorite_kworks async","text":"
    get_favorite_kworks()\n

    Get favorite kworks.

    Returns:

    Type Description list[Kwork]

    List of kworks

    Source code in src/kwork_api/client.py
    async def get_favorite_kworks(self) -> list[Kwork]:\n    \"\"\"\n    Get favorite kworks.\n\n    Returns:\n        List of kworks\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/favoriteKworks\")\n    return [Kwork.model_validate(k) for k in data.get(\"kworks\", [])]\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.UserAPI.get_info","title":"get_info async","text":"
    get_info()\n

    Get current user info.

    Returns:

    Type Description dict[str, Any]

    User info dict

    Source code in src/kwork_api/client.py
    async def get_info(self) -> dict[str, Any]:\n    \"\"\"\n    Get current user info.\n\n    Returns:\n        User info dict\n    \"\"\"\n    return await self.client._request(\"POST\", \"/user\")\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.UserAPI.get_reviews","title":"get_reviews async","text":"
    get_reviews(user_id=None, page=1)\n

    Get user reviews.

    Parameters:

    Name Type Description Default user_id Optional[int]

    User ID (None for current user)

    None page int

    Page number

    1

    Returns:

    Type Description ReviewsResponse

    ReviewsResponse

    Source code in src/kwork_api/client.py
    async def get_reviews(\n    self,\n    user_id: Optional[int] = None,\n    page: int = 1,\n) -> ReviewsResponse:\n    \"\"\"\n    Get user reviews.\n\n    Args:\n        user_id: User ID (None for current user)\n        page: Page number\n\n    Returns:\n        ReviewsResponse\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/userReviews\",\n        json={\"user_id\": user_id, \"page\": page},\n    )\n    return ReviewsResponse.model_validate(data)\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient-functions","title":"Functions","text":""},{"location":"api-reference/#kwork_api.client.KworkClient.close","title":"close async","text":"
    close()\n

    Close HTTP client.

    Source code in src/kwork_api/client.py
    async def close(self) -> None:\n    \"\"\"Close HTTP client.\"\"\"\n    if self._client and not self._client.is_closed:\n        await self._client.aclose()\n
    "},{"location":"api-reference/#kwork_api.client.KworkClient.login","title":"login async classmethod","text":"
    login(username, password, timeout=30.0)\n

    Login with username and password.

    Parameters:

    Name Type Description Default username str

    Kwork username or email

    required password str

    Kwork password

    required timeout float

    Request timeout

    30.0

    Returns:

    Type Description KworkClient

    Authenticated KworkClient instance

    Raises:

    Type Description KworkAuthError

    If login fails

    Source code in src/kwork_api/client.py
    @classmethod\nasync def login(\n    cls,\n    username: str,\n    password: str,\n    timeout: float = 30.0,\n) -> \"KworkClient\":\n    \"\"\"\n    Login with username and password.\n\n    Args:\n        username: Kwork username or email\n        password: Kwork password\n        timeout: Request timeout\n\n    Returns:\n        Authenticated KworkClient instance\n\n    Raises:\n        KworkAuthError: If login fails\n    \"\"\"\n    client = cls(timeout=timeout)\n\n    try:\n        async with client._get_httpx_client() as http_client:\n            # Step 1: Login to get session cookies\n            login_data = {\n                \"login_or_email\": username,\n                \"password\": password,\n            }\n\n            response = await http_client.post(\n                cls.LOGIN_URL,\n                data=login_data,\n                headers={\"Referer\": \"https://kwork.ru/\"},\n            )\n\n            if response.status_code != 200:\n                raise KworkAuthError(f\"Login failed: {response.status_code}\")\n\n            # Extract cookies\n            cookies = dict(response.cookies)\n\n            if \"userId\" not in cookies:\n                raise KworkAuthError(\"Login failed: no userId in cookies\")\n\n            # Step 2: Get web auth token\n            token_response = await http_client.post(\n                cls.TOKEN_URL,\n                json={},\n            )\n\n            if token_response.status_code != 200:\n                raise KworkAuthError(f\"Token request failed: {token_response.status_code}\")\n\n            token_data = token_response.json()\n            web_token = token_data.get(\"web_auth_token\")\n\n            if not web_token:\n                raise KworkAuthError(\"No web_auth_token in response\")\n\n            # Create new client with token\n            return cls(token=web_token, cookies=cookies, timeout=timeout)\n\n    except httpx.RequestError as e:\n        raise KworkNetworkError(f\"Login request failed: {e}\")\n
    "},{"location":"api-reference/#models","title":"Models","text":""},{"location":"api-reference/#kwork_api.models.Kwork","title":"kwork_api.models.Kwork","text":"

    Bases: BaseModel

    Kwork (service) information.

    "},{"location":"api-reference/#kwork_api.models.KworkDetails","title":"kwork_api.models.KworkDetails","text":"

    Bases: Kwork

    Extended kwork details.

    "},{"location":"api-reference/#kwork_api.models.Project","title":"kwork_api.models.Project","text":"

    Bases: BaseModel

    Project (freelance order) information.

    "},{"location":"api-reference/#kwork_api.models.CatalogResponse","title":"kwork_api.models.CatalogResponse","text":"

    Bases: BaseModel

    Catalog response with kworks and pagination.

    "},{"location":"api-reference/#errors","title":"Errors","text":""},{"location":"api-reference/#kwork_api.errors.KworkError","title":"kwork_api.errors.KworkError","text":"
    KworkError(message, response=None)\n

    Bases: Exception

    Base exception for all Kwork API errors.

    Source code in src/kwork_api/errors.py
    def __init__(self, message: str, response: Optional[Any] = None):\n    self.message = message\n    self.response = response\n    super().__init__(self.message)\n
    "},{"location":"api-reference/#kwork_api.errors.KworkAuthError","title":"kwork_api.errors.KworkAuthError","text":"
    KworkAuthError(\n    message=\"Authentication failed\", response=None\n)\n

    Bases: KworkError

    Authentication/authorization error.

    Source code in src/kwork_api/errors.py
    def __init__(self, message: str = \"Authentication failed\", response: Optional[Any] = None):\n    super().__init__(message, response)\n
    "},{"location":"api-reference/#kwork_api.errors.KworkApiError","title":"kwork_api.errors.KworkApiError","text":"
    KworkApiError(message, status_code=None, response=None)\n

    Bases: KworkError

    API request error (4xx, 5xx).

    Source code in src/kwork_api/errors.py
    def __init__(\n    self,\n    message: str,\n    status_code: Optional[int] = None,\n    response: Optional[Any] = None,\n):\n    self.status_code = status_code\n    super().__init__(message, response)\n
    "},{"location":"examples/","title":"Usage Examples","text":""},{"location":"examples/#catalog","title":"Catalog","text":""},{"location":"examples/#get-catalog-list","title":"Get Catalog List","text":"
    from kwork_api import KworkClient\n\nasync with KworkClient(token=\"token\") as client:\n    catalog = await client.catalog.get_list(page=1, category_id=5)\n\n    for kwork in catalog.kworks:\n        print(f\"{kwork.title}: {kwork.price} RUB\")\n\n    # Pagination\n    if catalog.pagination:\n        print(f\"Page {catalog.pagination.current_page} of {catalog.pagination.total_pages}\")\n
    "},{"location":"examples/#get-kwork-details","title":"Get Kwork Details","text":"
    details = await client.catalog.get_details(kwork_id=123)\n\nprint(f\"Title: {details.title}\")\nprint(f\"Price: {details.price}\")\nprint(f\"Description: {details.full_description}\")\nprint(f\"Delivery: {details.delivery_time} days\")\n
    "},{"location":"examples/#projects","title":"Projects","text":""},{"location":"examples/#get-projects-list","title":"Get Projects List","text":"
    projects = await client.projects.get_list(page=1)\n\nfor project in projects.projects:\n    print(f\"{project.title} - {project.budget} RUB\")\n
    "},{"location":"examples/#get-customer-orders","title":"Get Customer Orders","text":"
    orders = await client.projects.get_payer_orders()\n\nfor order in orders:\n    print(f\"Order #{order.id}: {order.status}\")\n
    "},{"location":"examples/#get-performer-orders","title":"Get Performer Orders","text":"
    orders = await client.projects.get_worker_orders()\n\nfor order in orders:\n    print(f\"Work #{order.id}: {order.status}\")\n
    "},{"location":"examples/#user","title":"User","text":""},{"location":"examples/#get-user-info","title":"Get User Info","text":"
    user_info = await client.user.get_info()\nprint(f\"Username: {user_info.get('username')}\")\n
    "},{"location":"examples/#get-reviews","title":"Get Reviews","text":"
    reviews = await client.user.get_reviews(page=1)\n\nfor review in reviews.reviews:\n    print(f\"Rating: {review.rating}/5 - {review.comment}\")\n
    "},{"location":"examples/#get-favorite-kworks","title":"Get Favorite Kworks","text":"
    favorites = await client.user.get_favorite_kworks()\n\nfor kwork in favorites:\n    print(f\"Favorite: {kwork.title}\")\n
    "},{"location":"examples/#reference-data","title":"Reference Data","text":""},{"location":"examples/#get-cities","title":"Get Cities","text":"
    cities = await client.reference.get_cities()\n\nfor city in cities:\n    print(f\"{city.id}: {city.name}\")\n
    "},{"location":"examples/#get-countries","title":"Get Countries","text":"
    countries = await client.reference.get_countries()\n\nfor country in countries:\n    print(f\"{country.id}: {country.name}\")\n
    "},{"location":"examples/#get-timezones","title":"Get Timezones","text":"
    timezones = await client.reference.get_timezones()\n\nfor tz in timezones:\n    print(f\"{tz.id}: {tz.name} ({tz.offset})\")\n
    "},{"location":"examples/#notifications","title":"Notifications","text":""},{"location":"examples/#get-notifications","title":"Get Notifications","text":"
    notifications = await client.notifications.get_list()\n\nfor notif in notifications.notifications:\n    print(f\"{notif.title}: {notif.message}\")\n\nprint(f\"Unread: {notifications.unread_count}\")\n
    "},{"location":"examples/#fetch-new-notifications","title":"Fetch New Notifications","text":"
    new_notifications = await client.notifications.fetch()\nprint(f\"New: {len(new_notifications.notifications)}\")\n
    "},{"location":"examples/#get-dialogs","title":"Get Dialogs","text":"
    dialogs = await client.notifications.get_dialogs()\n\nfor dialog in dialogs:\n    print(f\"Dialog with {dialog.participant.username}: {dialog.last_message}\")\n
    "},{"location":"examples/#error-handling","title":"Error Handling","text":"
    from kwork_api import KworkAuthError, KworkApiError, KworkNotFoundError\n\ntry:\n    catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n    print(f\"Authentication failed: {e}\")\nexcept KworkNotFoundError as e:\n    print(f\"Resource not found: {e}\")\nexcept KworkApiError as e:\n    print(f\"API error [{e.status_code}]: {e.message}\")\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n
    "},{"location":"examples/#rate-limiting","title":"Rate Limiting","text":"
    import asyncio\n\nasync def fetch_all_pages():\n    all_kworks = []\n\n    for page in range(1, 10):\n        try:\n            catalog = await client.catalog.get_list(page=page)\n            all_kworks.extend(catalog.kworks)\n\n            if not catalog.pagination or not catalog.pagination.has_next:\n                break\n\n            # Delay to avoid rate limiting\n            await asyncio.sleep(1)\n\n        except KworkRateLimitError:\n            print(\"Rate limited, waiting...\")\n            await asyncio.sleep(5)\n\n    return all_kworks\n
    "},{"location":"examples/#pagination-helper","title":"Pagination Helper","text":"
    async def fetch_all_catalog():\n    \"\"\"Fetch all kworks from catalog with pagination.\"\"\"\n    all_kworks = []\n    page = 1\n\n    while True:\n        catalog = await client.catalog.get_list(page=page)\n        all_kworks.extend(catalog.kworks)\n\n        if not catalog.pagination or not catalog.pagination.has_next:\n            break\n\n        page += 1\n        await asyncio.sleep(0.5)  # Rate limiting\n\n    return all_kworks\n

    More examples in the API Reference.

    "},{"location":"api/client/","title":"Client API","text":""},{"location":"api/client/#kwork_api.client.KworkClient","title":"kwork_api.client.KworkClient","text":"
    KworkClient(\n    token=None, cookies=None, timeout=30.0, base_url=None\n)\n

    Kwork.ru API client.

    Usage

    Initialize client.

    Parameters:

    Name Type Description Default token Optional[str]

    Web auth token (from getWebAuthToken)

    None cookies Optional[dict[str, str]]

    Session cookies (optional, will be set from token)

    None timeout float

    Request timeout in seconds

    30.0 base_url Optional[str]

    Custom base URL (for testing)

    None Source code in src/kwork_api/client.py
    def __init__(\n    self,\n    token: Optional[str] = None,\n    cookies: Optional[dict[str, str]] = None,\n    timeout: float = 30.0,\n    base_url: Optional[str] = None,\n):\n    \"\"\"\n    Initialize client.\n\n    Args:\n        token: Web auth token (from getWebAuthToken)\n        cookies: Session cookies (optional, will be set from token)\n        timeout: Request timeout in seconds\n        base_url: Custom base URL (for testing)\n    \"\"\"\n    self.base_url = base_url or self.BASE_URL\n    self.timeout = timeout\n    self._token = token\n    self._cookies = cookies or {}\n\n    # Initialize HTTP client\n    self._client: Optional[httpx.AsyncClient] = None\n
    "},{"location":"api/client/#kwork_api.client.KworkClient--login-with-credentials","title":"Login with credentials","text":"

    client = await KworkClient.login(\"username\", \"password\")

    "},{"location":"api/client/#kwork_api.client.KworkClient--or-restore-from-token","title":"Or restore from token","text":"

    client = KworkClient(token=\"your_web_auth_token\")

    "},{"location":"api/client/#kwork_api.client.KworkClient--make-requests","title":"Make requests","text":"

    catalog = await client.catalog.get_list(page=1)

    "},{"location":"api/client/#kwork_api.client.KworkClient-attributes","title":"Attributes","text":""},{"location":"api/client/#kwork_api.client.KworkClient.catalog","title":"catalog property","text":"
    catalog\n

    Catalog API.

    "},{"location":"api/client/#kwork_api.client.KworkClient.notifications","title":"notifications property","text":"
    notifications\n

    Notifications API.

    "},{"location":"api/client/#kwork_api.client.KworkClient.other","title":"other property","text":"
    other\n

    Other endpoints.

    "},{"location":"api/client/#kwork_api.client.KworkClient.projects","title":"projects property","text":"
    projects\n

    Projects API.

    "},{"location":"api/client/#kwork_api.client.KworkClient.reference","title":"reference property","text":"
    reference\n

    Reference data API.

    "},{"location":"api/client/#kwork_api.client.KworkClient.user","title":"user property","text":"
    user\n

    User API.

    "},{"location":"api/client/#kwork_api.client.KworkClient-classes","title":"Classes","text":""},{"location":"api/client/#kwork_api.client.KworkClient.CatalogAPI","title":"CatalogAPI","text":"
    CatalogAPI(client)\n

    Catalog/Kworks API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.CatalogAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.CatalogAPI.get_details","title":"get_details async","text":"
    get_details(kwork_id)\n

    Get kwork details.

    Parameters:

    Name Type Description Default kwork_id int

    Kwork ID

    required

    Returns:

    Type Description KworkDetails

    KworkDetails with full information

    Source code in src/kwork_api/client.py
    async def get_details(self, kwork_id: int) -> KworkDetails:\n    \"\"\"\n    Get kwork details.\n\n    Args:\n        kwork_id: Kwork ID\n\n    Returns:\n        KworkDetails with full information\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/getKworkDetails\",\n        json={\"kwork_id\": kwork_id},\n    )\n    return KworkDetails.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.CatalogAPI.get_details_extra","title":"get_details_extra async","text":"
    get_details_extra(kwork_id)\n

    Get additional kwork details.

    Parameters:

    Name Type Description Default kwork_id int

    Kwork ID

    required

    Returns:

    Type Description dict[str, Any]

    Extra details dict

    Source code in src/kwork_api/client.py
    async def get_details_extra(self, kwork_id: int) -> dict[str, Any]:\n    \"\"\"\n    Get additional kwork details.\n\n    Args:\n        kwork_id: Kwork ID\n\n    Returns:\n        Extra details dict\n    \"\"\"\n    return await self.client._request(\n        \"POST\",\n        \"/getKworkDetailsExtra\",\n        json={\"kwork_id\": kwork_id},\n    )\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.CatalogAPI.get_list","title":"get_list async","text":"
    get_list(page=1, category_id=None, sort='recommend')\n

    Get kworks catalog.

    Parameters:

    Name Type Description Default page int

    Page number

    1 category_id Optional[int]

    Category filter

    None sort str

    Sort option (recommend, price_asc, price_desc, etc.)

    'recommend'

    Returns:

    Type Description CatalogResponse

    CatalogResponse with kworks and pagination

    Source code in src/kwork_api/client.py
    async def get_list(\n    self,\n    page: int = 1,\n    category_id: Optional[int] = None,\n    sort: str = \"recommend\",\n) -> CatalogResponse:\n    \"\"\"\n    Get kworks catalog.\n\n    Args:\n        page: Page number\n        category_id: Category filter\n        sort: Sort option (recommend, price_asc, price_desc, etc.)\n\n    Returns:\n        CatalogResponse with kworks and pagination\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/catalogMainv2\",\n        json={\n            \"page\": page,\n            \"category_id\": category_id,\n            \"sort\": sort,\n        },\n    )\n    return CatalogResponse.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI","title":"NotificationsAPI","text":"
    NotificationsAPI(client)\n

    Notifications and messages endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI.fetch","title":"fetch async","text":"
    fetch()\n

    Fetch new notifications.

    Source code in src/kwork_api/client.py
    async def fetch(self) -> NotificationsResponse:\n    \"\"\"Fetch new notifications.\"\"\"\n    data = await self.client._request(\"POST\", \"/notificationsFetch\")\n    return NotificationsResponse.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI.get_blocked_dialogs","title":"get_blocked_dialogs async","text":"
    get_blocked_dialogs()\n

    Get blocked dialogs.

    Source code in src/kwork_api/client.py
    async def get_blocked_dialogs(self) -> list[Dialog]:\n    \"\"\"Get blocked dialogs.\"\"\"\n    data = await self.client._request(\"POST\", \"/blockedDialogList\")\n    return [Dialog.model_validate(d) for d in data.get(\"dialogs\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI.get_dialogs","title":"get_dialogs async","text":"
    get_dialogs()\n

    Get dialogs list.

    Source code in src/kwork_api/client.py
    async def get_dialogs(self) -> list[Dialog]:\n    \"\"\"Get dialogs list.\"\"\"\n    data = await self.client._request(\"POST\", \"/dialogs\")\n    return [Dialog.model_validate(d) for d in data.get(\"dialogs\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.NotificationsAPI.get_list","title":"get_list async","text":"
    get_list()\n

    Get notifications list.

    Source code in src/kwork_api/client.py
    async def get_list(self) -> NotificationsResponse:\n    \"\"\"Get notifications list.\"\"\"\n    data = await self.client._request(\"POST\", \"/notifications\")\n    return NotificationsResponse.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI","title":"OtherAPI","text":"
    OtherAPI(client)\n

    Other API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_actor","title":"get_actor async","text":"
    get_actor()\n

    Get actor info.

    Source code in src/kwork_api/client.py
    async def get_actor(self) -> dict[str, Any]:\n    \"\"\"Get actor info.\"\"\"\n    return await self.client._request(\"POST\", \"/actor\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_channel","title":"get_channel async","text":"
    get_channel()\n

    Get channel info.

    Source code in src/kwork_api/client.py
    async def get_channel(self) -> dict[str, Any]:\n    \"\"\"Get channel info.\"\"\"\n    return await self.client._request(\"POST\", \"/getChannel\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_exchange_info","title":"get_exchange_info async","text":"
    get_exchange_info()\n

    Get exchange info.

    Source code in src/kwork_api/client.py
    async def get_exchange_info(self) -> dict[str, Any]:\n    \"\"\"Get exchange info.\"\"\"\n    return await self.client._request(\"POST\", \"/exchangeInfo\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_favorite_categories","title":"get_favorite_categories async","text":"
    get_favorite_categories()\n

    Get favorite categories.

    Source code in src/kwork_api/client.py
    async def get_favorite_categories(self) -> list[int]:\n    \"\"\"Get favorite categories.\"\"\"\n    data = await self.client._request(\"POST\", \"/favoriteCategories\")\n    return data.get(\"categories\", [])\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_in_app_notification","title":"get_in_app_notification async","text":"
    get_in_app_notification()\n

    Get in-app notification.

    Source code in src/kwork_api/client.py
    async def get_in_app_notification(self) -> dict[str, Any]:\n    \"\"\"Get in-app notification.\"\"\"\n    return await self.client._request(\"POST\", \"/getInAppNotification\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_kworks_status","title":"get_kworks_status async","text":"
    get_kworks_status()\n

    Get kworks status.

    Source code in src/kwork_api/client.py
    async def get_kworks_status(self) -> dict[str, Any]:\n    \"\"\"Get kworks status.\"\"\"\n    return await self.client._request(\"POST\", \"/kworksStatusList\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_offers","title":"get_offers async","text":"
    get_offers()\n

    Get offers.

    Source code in src/kwork_api/client.py
    async def get_offers(self) -> dict[str, Any]:\n    \"\"\"Get offers.\"\"\"\n    return await self.client._request(\"POST\", \"/offers\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_security_user_data","title":"get_security_user_data async","text":"
    get_security_user_data()\n

    Get security user data.

    Source code in src/kwork_api/client.py
    async def get_security_user_data(self) -> dict[str, Any]:\n    \"\"\"Get security user data.\"\"\"\n    return await self.client._request(\"POST\", \"/getSecurityUserData\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_viewed_kworks","title":"get_viewed_kworks async","text":"
    get_viewed_kworks()\n

    Get viewed kworks.

    Source code in src/kwork_api/client.py
    async def get_viewed_kworks(self) -> list[Kwork]:\n    \"\"\"Get viewed kworks.\"\"\"\n    data = await self.client._request(\"POST\", \"/viewedCatalogKworks\")\n    return [Kwork.model_validate(k) for k in data.get(\"kworks\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_wants","title":"get_wants async","text":"
    get_wants()\n

    Get user wants.

    Source code in src/kwork_api/client.py
    async def get_wants(self) -> dict[str, Any]:\n    \"\"\"Get user wants.\"\"\"\n    return await self.client._request(\"POST\", \"/myWants\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.get_wants_status","title":"get_wants_status async","text":"
    get_wants_status()\n

    Get wants status.

    Source code in src/kwork_api/client.py
    async def get_wants_status(self) -> dict[str, Any]:\n    \"\"\"Get wants status.\"\"\"\n    return await self.client._request(\"POST\", \"/wantsStatusList\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.go_offline","title":"go_offline async","text":"
    go_offline()\n

    Set user status to offline.

    Source code in src/kwork_api/client.py
    async def go_offline(self) -> dict[str, Any]:\n    \"\"\"Set user status to offline.\"\"\"\n    return await self.client._request(\"POST\", \"/offline\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.is_dialog_allow","title":"is_dialog_allow async","text":"
    is_dialog_allow(user_id)\n

    Check if dialog is allowed.

    Source code in src/kwork_api/client.py
    async def is_dialog_allow(self, user_id: int) -> bool:\n    \"\"\"Check if dialog is allowed.\"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/isDialogAllow\",\n        json={\"user_id\": user_id},\n    )\n    return data.get(\"allowed\", False)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.OtherAPI.update_settings","title":"update_settings async","text":"
    update_settings(settings)\n

    Update user settings.

    Source code in src/kwork_api/client.py
    async def update_settings(self, settings: dict[str, Any]) -> dict[str, Any]:\n    \"\"\"Update user settings.\"\"\"\n    return await self.client._request(\"POST\", \"/updateSettings\", json=settings)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ProjectsAPI","title":"ProjectsAPI","text":"
    ProjectsAPI(client)\n

    Projects (freelance orders) API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ProjectsAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.ProjectsAPI.get_list","title":"get_list async","text":"
    get_list(page=1, category_id=None)\n

    Get projects list.

    Parameters:

    Name Type Description Default page int

    Page number

    1 category_id Optional[int]

    Category filter

    None

    Returns:

    Type Description ProjectsResponse

    ProjectsResponse with projects and pagination

    Source code in src/kwork_api/client.py
    async def get_list(\n    self,\n    page: int = 1,\n    category_id: Optional[int] = None,\n) -> ProjectsResponse:\n    \"\"\"\n    Get projects list.\n\n    Args:\n        page: Page number\n        category_id: Category filter\n\n    Returns:\n        ProjectsResponse with projects and pagination\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/projects\",\n        json={\n            \"page\": page,\n            \"category_id\": category_id,\n        },\n    )\n    return ProjectsResponse.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ProjectsAPI.get_payer_orders","title":"get_payer_orders async","text":"
    get_payer_orders()\n

    Get orders where user is customer.

    Returns:

    Type Description list[Project]

    List of projects

    Source code in src/kwork_api/client.py
    async def get_payer_orders(self) -> list[Project]:\n    \"\"\"\n    Get orders where user is customer.\n\n    Returns:\n        List of projects\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/payerOrders\")\n    return [Project.model_validate(p) for p in data.get(\"orders\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ProjectsAPI.get_worker_orders","title":"get_worker_orders async","text":"
    get_worker_orders()\n

    Get orders where user is performer.

    Returns:

    Type Description list[Project]

    List of projects

    Source code in src/kwork_api/client.py
    async def get_worker_orders(self) -> list[Project]:\n    \"\"\"\n    Get orders where user is performer.\n\n    Returns:\n        List of projects\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/workerOrders\")\n    return [Project.model_validate(p) for p in data.get(\"orders\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI","title":"ReferenceAPI","text":"
    ReferenceAPI(client)\n

    Reference data (cities, countries, etc.) endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_badges_info","title":"get_badges_info async","text":"
    get_badges_info()\n

    Get badges info.

    Source code in src/kwork_api/client.py
    async def get_badges_info(self) -> list[Badge]:\n    \"\"\"Get badges info.\"\"\"\n    data = await self.client._request(\"POST\", \"/getBadgesInfo\")\n    return [Badge.model_validate(b) for b in data.get(\"badges\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_cities","title":"get_cities async","text":"
    get_cities()\n

    Get all cities.

    Source code in src/kwork_api/client.py
    async def get_cities(self) -> list[City]:\n    \"\"\"Get all cities.\"\"\"\n    data = await self.client._request(\"POST\", \"/cities\")\n    return [City.model_validate(c) for c in data.get(\"cities\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_countries","title":"get_countries async","text":"
    get_countries()\n

    Get all countries.

    Source code in src/kwork_api/client.py
    async def get_countries(self) -> list[Country]:\n    \"\"\"Get all countries.\"\"\"\n    data = await self.client._request(\"POST\", \"/countries\")\n    return [Country.model_validate(c) for c in data.get(\"countries\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_features","title":"get_features async","text":"
    get_features()\n

    Get available features.

    Source code in src/kwork_api/client.py
    async def get_features(self) -> list[Feature]:\n    \"\"\"Get available features.\"\"\"\n    data = await self.client._request(\"POST\", \"/getAvailableFeatures\")\n    return [Feature.model_validate(f) for f in data.get(\"features\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_public_features","title":"get_public_features async","text":"
    get_public_features()\n

    Get public features.

    Source code in src/kwork_api/client.py
    async def get_public_features(self) -> list[Feature]:\n    \"\"\"Get public features.\"\"\"\n    data = await self.client._request(\"POST\", \"/getPublicFeatures\")\n    return [Feature.model_validate(f) for f in data.get(\"features\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.ReferenceAPI.get_timezones","title":"get_timezones async","text":"
    get_timezones()\n

    Get all timezones.

    Source code in src/kwork_api/client.py
    async def get_timezones(self) -> list[TimeZone]:\n    \"\"\"Get all timezones.\"\"\"\n    data = await self.client._request(\"POST\", \"/timezones\")\n    return [TimeZone.model_validate(t) for t in data.get(\"timezones\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.UserAPI","title":"UserAPI","text":"
    UserAPI(client)\n

    User API endpoints.

    Source code in src/kwork_api/client.py
    def __init__(self, client: \"KworkClient\"):\n    self.client = client\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.UserAPI-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.UserAPI.get_favorite_kworks","title":"get_favorite_kworks async","text":"
    get_favorite_kworks()\n

    Get favorite kworks.

    Returns:

    Type Description list[Kwork]

    List of kworks

    Source code in src/kwork_api/client.py
    async def get_favorite_kworks(self) -> list[Kwork]:\n    \"\"\"\n    Get favorite kworks.\n\n    Returns:\n        List of kworks\n    \"\"\"\n    data = await self.client._request(\"POST\", \"/favoriteKworks\")\n    return [Kwork.model_validate(k) for k in data.get(\"kworks\", [])]\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.UserAPI.get_info","title":"get_info async","text":"
    get_info()\n

    Get current user info.

    Returns:

    Type Description dict[str, Any]

    User info dict

    Source code in src/kwork_api/client.py
    async def get_info(self) -> dict[str, Any]:\n    \"\"\"\n    Get current user info.\n\n    Returns:\n        User info dict\n    \"\"\"\n    return await self.client._request(\"POST\", \"/user\")\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.UserAPI.get_reviews","title":"get_reviews async","text":"
    get_reviews(user_id=None, page=1)\n

    Get user reviews.

    Parameters:

    Name Type Description Default user_id Optional[int]

    User ID (None for current user)

    None page int

    Page number

    1

    Returns:

    Type Description ReviewsResponse

    ReviewsResponse

    Source code in src/kwork_api/client.py
    async def get_reviews(\n    self,\n    user_id: Optional[int] = None,\n    page: int = 1,\n) -> ReviewsResponse:\n    \"\"\"\n    Get user reviews.\n\n    Args:\n        user_id: User ID (None for current user)\n        page: Page number\n\n    Returns:\n        ReviewsResponse\n    \"\"\"\n    data = await self.client._request(\n        \"POST\",\n        \"/userReviews\",\n        json={\"user_id\": user_id, \"page\": page},\n    )\n    return ReviewsResponse.model_validate(data)\n
    "},{"location":"api/client/#kwork_api.client.KworkClient-functions","title":"Functions","text":""},{"location":"api/client/#kwork_api.client.KworkClient.close","title":"close async","text":"
    close()\n

    Close HTTP client.

    Source code in src/kwork_api/client.py
    async def close(self) -> None:\n    \"\"\"Close HTTP client.\"\"\"\n    if self._client and not self._client.is_closed:\n        await self._client.aclose()\n
    "},{"location":"api/client/#kwork_api.client.KworkClient.login","title":"login async classmethod","text":"
    login(username, password, timeout=30.0)\n

    Login with username and password.

    Parameters:

    Name Type Description Default username str

    Kwork username or email

    required password str

    Kwork password

    required timeout float

    Request timeout

    30.0

    Returns:

    Type Description KworkClient

    Authenticated KworkClient instance

    Raises:

    Type Description KworkAuthError

    If login fails

    Source code in src/kwork_api/client.py
    @classmethod\nasync def login(\n    cls,\n    username: str,\n    password: str,\n    timeout: float = 30.0,\n) -> \"KworkClient\":\n    \"\"\"\n    Login with username and password.\n\n    Args:\n        username: Kwork username or email\n        password: Kwork password\n        timeout: Request timeout\n\n    Returns:\n        Authenticated KworkClient instance\n\n    Raises:\n        KworkAuthError: If login fails\n    \"\"\"\n    client = cls(timeout=timeout)\n\n    try:\n        async with client._get_httpx_client() as http_client:\n            # Step 1: Login to get session cookies\n            login_data = {\n                \"login_or_email\": username,\n                \"password\": password,\n            }\n\n            response = await http_client.post(\n                cls.LOGIN_URL,\n                data=login_data,\n                headers={\"Referer\": \"https://kwork.ru/\"},\n            )\n\n            if response.status_code != 200:\n                raise KworkAuthError(f\"Login failed: {response.status_code}\")\n\n            # Extract cookies\n            cookies = dict(response.cookies)\n\n            if \"userId\" not in cookies:\n                raise KworkAuthError(\"Login failed: no userId in cookies\")\n\n            # Step 2: Get web auth token\n            token_response = await http_client.post(\n                cls.TOKEN_URL,\n                json={},\n            )\n\n            if token_response.status_code != 200:\n                raise KworkAuthError(f\"Token request failed: {token_response.status_code}\")\n\n            token_data = token_response.json()\n            web_token = token_data.get(\"web_auth_token\")\n\n            if not web_token:\n                raise KworkAuthError(\"No web_auth_token in response\")\n\n            # Create new client with token\n            return cls(token=web_token, cookies=cookies, timeout=timeout)\n\n    except httpx.RequestError as e:\n        raise KworkNetworkError(f\"Login request failed: {e}\")\n
    "},{"location":"api/errors/","title":"Errors","text":"

    Exception classes for error handling.

    "},{"location":"api/errors/#kworkerror","title":"KworkError","text":""},{"location":"api/errors/#kwork_api.errors.KworkError","title":"kwork_api.errors.KworkError","text":"
    KworkError(message, response=None)\n

    Bases: Exception

    Base exception for all Kwork API errors.

    Source code in src/kwork_api/errors.py
    def __init__(self, message: str, response: Optional[Any] = None):\n    self.message = message\n    self.response = response\n    super().__init__(self.message)\n
    "},{"location":"api/errors/#kworkautherror","title":"KworkAuthError","text":""},{"location":"api/errors/#kwork_api.errors.KworkAuthError","title":"kwork_api.errors.KworkAuthError","text":"
    KworkAuthError(\n    message=\"Authentication failed\", response=None\n)\n

    Bases: KworkError

    Authentication/authorization error.

    Source code in src/kwork_api/errors.py
    def __init__(self, message: str = \"Authentication failed\", response: Optional[Any] = None):\n    super().__init__(message, response)\n
    "},{"location":"api/errors/#kworkapierror","title":"KworkApiError","text":""},{"location":"api/errors/#kwork_api.errors.KworkApiError","title":"kwork_api.errors.KworkApiError","text":"
    KworkApiError(message, status_code=None, response=None)\n

    Bases: KworkError

    API request error (4xx, 5xx).

    Source code in src/kwork_api/errors.py
    def __init__(\n    self,\n    message: str,\n    status_code: Optional[int] = None,\n    response: Optional[Any] = None,\n):\n    self.status_code = status_code\n    super().__init__(message, response)\n
    "},{"location":"api/errors/#kworknotfounderror","title":"KworkNotFoundError","text":""},{"location":"api/errors/#kwork_api.errors.KworkNotFoundError","title":"kwork_api.errors.KworkNotFoundError","text":"
    KworkNotFoundError(resource, response=None)\n

    Bases: KworkApiError

    Resource not found (404).

    Source code in src/kwork_api/errors.py
    def __init__(self, resource: str, response: Optional[Any] = None):\n    super().__init__(f\"Resource not found: {resource}\", 404, response)\n
    "},{"location":"api/errors/#kworkratelimiterror","title":"KworkRateLimitError","text":""},{"location":"api/errors/#kwork_api.errors.KworkRateLimitError","title":"kwork_api.errors.KworkRateLimitError","text":"
    KworkRateLimitError(\n    message=\"Rate limit exceeded\", response=None\n)\n

    Bases: KworkApiError

    Rate limit exceeded (429).

    Source code in src/kwork_api/errors.py
    def __init__(self, message: str = \"Rate limit exceeded\", response: Optional[Any] = None):\n    super().__init__(message, 429, response)\n
    "},{"location":"api/models/","title":"Models","text":"

    Pydantic models used in API responses.

    "},{"location":"api/models/#kwork","title":"Kwork","text":""},{"location":"api/models/#kwork_api.models.Kwork","title":"kwork_api.models.Kwork","text":"

    Bases: BaseModel

    Kwork (service) information.

    "},{"location":"api/models/#kworkdetails","title":"KworkDetails","text":""},{"location":"api/models/#kwork_api.models.KworkDetails","title":"kwork_api.models.KworkDetails","text":"

    Bases: Kwork

    Extended kwork details.

    "},{"location":"api/models/#project","title":"Project","text":""},{"location":"api/models/#kwork_api.models.Project","title":"kwork_api.models.Project","text":"

    Bases: BaseModel

    Project (freelance order) information.

    "},{"location":"api/models/#catalogresponse","title":"CatalogResponse","text":""},{"location":"api/models/#kwork_api.models.CatalogResponse","title":"kwork_api.models.CatalogResponse","text":"

    Bases: BaseModel

    Catalog response with kworks and pagination.

    "},{"location":"api/models/#paginationinfo","title":"PaginationInfo","text":""},{"location":"api/models/#kwork_api.models.PaginationInfo","title":"kwork_api.models.PaginationInfo","text":"

    Bases: BaseModel

    Pagination metadata.

    "}]} \ No newline at end of file diff --git a/site/sitemap.xml b/site/sitemap.xml index 961b512..bd271b5 100644 --- a/site/sitemap.xml +++ b/site/sitemap.xml @@ -12,4 +12,16 @@ https://github.com/claw/kwork-api/examples/ 2026-03-23 + + https://github.com/claw/kwork-api/api/client/ + 2026-03-23 + + + https://github.com/claw/kwork-api/api/errors/ + 2026-03-23 + + + https://github.com/claw/kwork-api/api/models/ + 2026-03-23 + \ No newline at end of file diff --git a/site/sitemap.xml.gz b/site/sitemap.xml.gz index 88d4371..2dadf0c 100644 Binary files a/site/sitemap.xml.gz and b/site/sitemap.xml.gz differ