Python SDK for OmegaHire vacancy integration API
Project description
omegavacancy-sdk
Python SDK для интеграционного API OmegaHire (/api/v1/vacancies).
Подробная инструкция публикации в TestPyPI/PyPI: PUBLISHING_RU.md.
Install
pip install -e .
Usage
Быстрый API (без base_url) — рекомендуется
from omegavacancy_sdk import create_vacancy, delete_vacancy, get_vacancies
api_key = "ovk_xxxxx_secret"
vacancies = get_vacancies(api_key)
print(vacancies["count"])
created = create_vacancy(
api_key,
{
"title": "Python Developer",
"vacancy_text": "Need FastAPI + PostgreSQL",
"skills": ["Python", "FastAPI"],
},
)
print(created["vacancy_ids"])
deleted = delete_vacancy(api_key, "AB-12345")
print(deleted["success"], deleted["vacancy_id"])
# При медленном ответе сервера можно увеличить таймаут и число ретраев
created_retry = create_vacancy(
api_key,
{"title": "Data Engineer"},
timeout=90.0,
max_retries=3,
)
print(created_retry["success"])
В этом режиме SDK использует встроенный адрес API: https://omegahire.tech.
Расширенный API (OmegaVacancyClient)
from omegavacancy_sdk import OmegaVacancyClient
api_key = "ovk_xxxxx_secret"
with OmegaVacancyClient(
base_url="https://your-host",
api_key=api_key,
timeout=90.0,
max_retries=3,
) as client:
created = client.create_vacancy({
"title": "Python Developer",
"vacancy_text": "Need FastAPI + PostgreSQL",
"skills": ["Python", "FastAPI"],
})
print(created.vacancy_ids)
for vacancy_id in created.vacancy_ids:
deleted = client.delete_vacancy(vacancy_id)
print(deleted.success, deleted.vacancy_id)
Errors
OmegaVacancyAuthError— 401/403OmegaVacancyValidationError— 422OmegaVacancyServerError— 5xx/transportOmegaVacancyError— прочие ошибки
Какие методы доступны сейчас
Быстрый модуль
get_vacancies(api_key: str, *, timeout: float | httpx.Timeout = 30.0, max_retries: int = 2) -> dictcreate_vacancy(api_key: str, vacancy_json: dict, *, timeout: float | httpx.Timeout = 30.0, max_retries: int = 2) -> dictdelete_vacancy(api_key: str, vacancy_id: str, *, timeout: float | httpx.Timeout = 30.0, max_retries: int = 2) -> dict
OmegaVacancyClient
create_vacancy(vacancy: dict) -> CreateVacancyResultcreate_vacancies(vacancies: list[dict]) -> CreateVacancyResultdelete_vacancy(vacancy_id: str) -> DeleteVacancyResultclose() -> None
Контекстный менеджер:
__enter__()/__exit__(...)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
omegavacancy_sdk-0.2.1.tar.gz
(23.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omegavacancy_sdk-0.2.1.tar.gz.
File metadata
- Download URL: omegavacancy_sdk-0.2.1.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4662b85d8e2c4dcc57ac1b42bfbb3daeb887bac1a8e6ea1622771b089620af2a
|
|
| MD5 |
c583ce73d18c3b128364f1a74b5c00db
|
|
| BLAKE2b-256 |
19b24e5e492fbe008b0df7f1e9927d3ac3545e33e35f644380e9882107f7d3ca
|
File details
Details for the file omegavacancy_sdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: omegavacancy_sdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8e62012705ef81b3d3bbc6516189c65d55c2ce6dac4e0bcb7da1079c6fee920
|
|
| MD5 |
018fba341e1420660a3ef835b07d9f33
|
|
| BLAKE2b-256 |
d63e7096878e254073f4b292e858a182d63a93c2dfa8900904d34c95bf30c4a0
|