ISDuBA Python Client
A client library for accessing ISDuBA API, based on code generated by https://github.com/openapi-generators/openapi-python-client and adapted to ISDuBA-specific needs.
Usage
First, create a client instance:
from isduba import Client
client = Client(base_url="https://isduba.example.com")
Then, login with your credentials:
client.login(username='ada', password='bob')
Now call your endpoint and use your models:
from isduba.api.default import get_about
about = get_about.sync(client=client)
# access the response's value as attributes:
about.version
# or if you need more info (e.g. status_code)
response = get_about.sync_detailed(client=client)
Or do the same thing with an async version:
from isduba.api.default import get_about
about = await get_about.asyncio(client=client)
response = await get_about.asyncio_detailed(client=client)
Get documents
from isduba.api.default import get_documents
data = get_documents.sync(client=client, advisories=True, count=1, orders='-critical', limit=10, offset=0)
# search for a string
get_documents.sync(client=client, query='"csaf" search _clientSearch as')
# search for a product. Query syntax: https://github.com/ISDuBA/ISDuBA/blob/main/docs/filter_expr.md
data = get_documents.sync(client=client, query='"putty" ilikepname', limit=2)
Usage Logic
Things to know:
-
Every path/method combo becomes a Python module with four functions:
sync: Blocking request that returns parsed data (if successful) orNonesync_detailed: Blocking request that always returns aRequest, optionally withparsedset if the request was successful.asyncio: Likesyncbut async instead of blockingasyncio_detailed: Likesync_detailedbut async instead of blocking
-
All path/query params, and bodies become method arguments.
-
If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
-
Any endpoint which did not have a tag will be in
isduba.api.default
Typing
All responses are objects, you can add typing information with the models:
from isduba.models import WebAboutInfo
from isduba.api.default import get_about
from isduba.types import Response
about: WebAboutInfo = get_about.sync(client=client)
# access the response's value as attributes:
about.version
# or if you need more info (e.g. status_code)
response: Response[WebAboutInfo] = get_about.sync_detailed(client=client)
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):
from isduba 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://isduba.example.com",
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)
Metadata
Release files for isduba 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| isduba-0.1.0.tar.gz | 39.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| isduba-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 206.8 kB
Release files / isduba-0.1.0.tar.gz
| Download URL | isduba-0.1.0.tar.gz |
|---|---|
| Size | 39.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63380110bdea86342776b3ec30a216d7075b5bf2a0091003bea5e28ca9a722e6
|
|
BLAKE2b-256 checksum How to use checksums |
e1db00e121301a002633041910538c464e6147c471297d2d37076159679d7142
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / isduba-0.1.0-py3-none-any.whl
| Download URL | isduba-0.1.0-py3-none-any.whl |
|---|---|
| Size | 167.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6a543a41d8b35403ba52f13207791e2016f9f49222415e07da85a032f01a8af
|
|
BLAKE2b-256 checksum How to use checksums |
5a041f650e1a9cba0aa1e13f4822cc91b394c5965ad5b9ae1650ef73f66488be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for isduba 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.