# conduktor-public-api-client
A client library for accessing Conduktor Public API
Generated with `openapi-python-client generate --path docs.yaml`
## Usage
First, create a client:
```python
from conduktor_public_api_client import AuthenticatedClient
client = AuthenticatedClient(
base_url="https://api.example.com", token="SuperSecretToken"
)
```
Things to know:
1. Every path/method combo becomes a Python module with four functions:
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
1. `asyncio`: Like `sync` but async instead of blocking
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
1. All path/query params, and bodies become method arguments.
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
1. Any endpoint which did not have a tag will be in `conduktor_public_api_client.api.default`
## Advanced customizations
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
```python
from conduktor_public_api_client import Client
def log_request(request):
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
def log_response(response):
request = response.request
print(
f"Response event hook: {request.method} {request.url} - Status {response.status_code}"
)
client = Client(
base_url="https://api.example.com",
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
```
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
```python
import httpx
from conduktor_public_api_client import Client
client = Client(
base_url="https://api.example.com",
)
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
client.set_httpx_client(
httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")
)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "conduktor-public-api-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "conduktor,kafka",
"author": "John \"Preston\" Mille",
"author_email": "john@ews-network.net",
"download_url": "https://files.pythonhosted.org/packages/33/b1/3785977f50359c07991044252d52a1cc1ff0f78f245238aceddb495af741/conduktor_public_api_client-0.0.1.tar.gz",
"platform": null,
"description": "# conduktor-public-api-client\nA client library for accessing Conduktor Public API\nGenerated with `openapi-python-client generate --path docs.yaml`\n\n## Usage\nFirst, create a client:\n\n```python\nfrom conduktor_public_api_client import AuthenticatedClient\n\nclient = AuthenticatedClient(\n base_url=\"https://api.example.com\", token=\"SuperSecretToken\"\n)\n```\n\nThings to know:\n1. Every path/method combo becomes a Python module with four functions:\n 1. `sync`: Blocking request that returns parsed data (if successful) or `None`\n 1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.\n 1. `asyncio`: Like `sync` but async instead of blocking\n 1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking\n\n1. All path/query params, and bodies become method arguments.\n1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)\n1. Any endpoint which did not have a tag will be in `conduktor_public_api_client.api.default`\n\n## Advanced customizations\n\nThere are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):\n\n```python\nfrom conduktor_public_api_client import Client\n\n\ndef log_request(request):\n print(f\"Request event hook: {request.method} {request.url} - Waiting for response\")\n\n\ndef log_response(response):\n request = response.request\n print(\n f\"Response event hook: {request.method} {request.url} - Status {response.status_code}\"\n )\n\n\nclient = Client(\n base_url=\"https://api.example.com\",\n httpx_args={\"event_hooks\": {\"request\": [log_request], \"response\": [log_response]}},\n)\n\n# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()\n```\n\nYou can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):\n\n```python\nimport httpx\nfrom conduktor_public_api_client import Client\n\nclient = Client(\n base_url=\"https://api.example.com\",\n)\n# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.\nclient.set_httpx_client(\n httpx.Client(base_url=\"https://api.example.com\", proxies=\"http://localhost:8030\")\n)\n```\n",
"bugtrack_url": null,
"license": "LICENSE",
"summary": "A client library for accessing Conduktor Public API",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"conduktor",
"kafka"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "31d14b3fa72e17f61ba5c6378ff183e02ed50ae0611a11ea8311d91fa4d4157a",
"md5": "1d2a4eff57ed524c0c0c674cb07129b4",
"sha256": "1a783676e9b72de47d6ee584b74dd3e94f2e3fb76c496b30c3c877313a06c346"
},
"downloads": -1,
"filename": "conduktor_public_api_client-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d2a4eff57ed524c0c0c674cb07129b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 104355,
"upload_time": "2023-08-02T21:02:57",
"upload_time_iso_8601": "2023-08-02T21:02:57.547246Z",
"url": "https://files.pythonhosted.org/packages/31/d1/4b3fa72e17f61ba5c6378ff183e02ed50ae0611a11ea8311d91fa4d4157a/conduktor_public_api_client-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33b13785977f50359c07991044252d52a1cc1ff0f78f245238aceddb495af741",
"md5": "5f6681838939dfcfca10cd493843f5fb",
"sha256": "b56c532b6a5450a0042605da3d9b18adc5ccb1eef39999e6078eb68a8d87b9cd"
},
"downloads": -1,
"filename": "conduktor_public_api_client-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "5f6681838939dfcfca10cd493843f5fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 35907,
"upload_time": "2023-08-02T21:02:59",
"upload_time_iso_8601": "2023-08-02T21:02:59.486740Z",
"url": "https://files.pythonhosted.org/packages/33/b1/3785977f50359c07991044252d52a1cc1ff0f78f245238aceddb495af741/conduktor_public_api_client-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-02 21:02:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "conduktor-public-api-client"
}