{"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":"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":"::: kwork_api.client.KworkClient
"},{"location":"api-reference/#models","title":"Models","text":"::: kwork_api.models.Kwork
::: kwork_api.models.KworkDetails
::: kwork_api.models.Project
::: kwork_api.models.CatalogResponse
"},{"location":"api-reference/#errors","title":"Errors","text":"::: kwork_api.errors.KworkError
::: kwork_api.errors.KworkAuthError
::: kwork_api.errors.KworkApiError
"},{"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":"::: kwork_api.client.KworkClient options: show_root_heading: true show_source: true merge_init_into_class: true
"},{"location":"api/errors/","title":"Errors","text":"Exception classes for error handling.
"},{"location":"api/errors/#kworkerror","title":"KworkError","text":"::: kwork_api.errors.KworkError
"},{"location":"api/errors/#kworkautherror","title":"KworkAuthError","text":"::: kwork_api.errors.KworkAuthError
"},{"location":"api/errors/#kworkapierror","title":"KworkApiError","text":"::: kwork_api.errors.KworkApiError
"},{"location":"api/errors/#kworknotfounderror","title":"KworkNotFoundError","text":"::: kwork_api.errors.KworkNotFoundError
"},{"location":"api/errors/#kworkratelimiterror","title":"KworkRateLimitError","text":"::: kwork_api.errors.KworkRateLimitError
"},{"location":"api/models/","title":"Models","text":"Pydantic models used in API responses.
"},{"location":"api/models/#kwork","title":"Kwork","text":"::: kwork_api.models.Kwork
"},{"location":"api/models/#kworkdetails","title":"KworkDetails","text":"::: kwork_api.models.KworkDetails
"},{"location":"api/models/#project","title":"Project","text":"::: kwork_api.models.Project
"},{"location":"api/models/#catalogresponse","title":"CatalogResponse","text":"::: kwork_api.models.CatalogResponse
"},{"location":"api/models/#paginationinfo","title":"PaginationInfo","text":"::: kwork_api.models.PaginationInfo
"}]}