OpenqQA Client Library with Async Support
Project description
openqa-async
An httpx-based client for the
openQA REST API, exposing both a synchronous and an
asynchronous API. It is a port of
openQA-python-client
from requests to httpx, preserving its HMAC request signing, client.conf
discovery, and YAML-response fallback.
Installation
uv add openqa-async
# or
pip install openqa-async
Usage
Synchronous
from openqa_async import OpenQAClient
with OpenQAClient(server="openqa.opensuse.org") as client:
jobs = client.openqa_request("GET", "/api/v1/jobs", params={"limit": 10})
print(jobs)
Asynchronous
import asyncio
from openqa_async import AsyncOpenQAClient
async def main():
async with AsyncOpenQAClient(server="openqa.opensuse.org") as client:
jobs = await client.openqa_request(
"GET", "/api/v1/jobs", params={"limit": 10}
)
print(jobs)
asyncio.run(main())
openqa_request signature
Both clients share the same request method (the async one is awaitable):
openqa_request(
method, # "GET", "POST", ...
path, # e.g. "/api/v1/jobs" (a leading slash is optional)
params=None, # query-string parameters
retries=None, # override the client default (5)
wait=None, # override the initial backoff in seconds (10)
data=None, # form-encoded body
json=None, # JSON body
)
Responses are parsed automatically: a text/yaml body is loaded with
yaml.safe_load, a 204 No Content (or parse=False) returns the raw
httpx.Response, and everything else is decoded as JSON. Non-2xx responses
raise RequestError; transport failures raise ConnectionError. Retryable
status codes (e.g. 503) are retried with exponential backoff.
Configuration
Credentials are read from INI-style client.conf files, searched in order:
/etc/openqa/client.conf~/.config/openqa/client.conf
Each section is keyed by the server host (or full base URL) and provides the
API key/secret:
[openqa.opensuse.org]
key = YOUR_API_KEY
secret = YOUR_API_SECRET
The lookup tries the bare server section first, then the full base URL
section. When a key/secret is present, requests are HMAC-SHA1 signed and the
X-API-Key header is sent. Without credentials only unauthenticated GET
requests are possible.
Scheme defaulting: the scheme defaults to https, except for loopback
hosts (localhost, 127.0.0.1, ::1), which default to http. You can also
pass a fully-qualified server such as http://openqa.example.com.
Migration from openQA-python-client
For code written against the upstream requests-based client, a compatibility
alias keeps most call sites working unchanged:
from openqa_async import OpenQA_Client # alias for OpenQAClient
client = OpenQA_Client(server="openqa.opensuse.org")
jobs = client.openqa_request("GET", "/api/v1/jobs")
OpenQA_Client is the synchronous OpenQAClient, and openqa_request keeps
the same method/path semantics. New code should prefer OpenQAClient /
AsyncOpenQAClient directly.
Disabling TLS verification
Both clients accept a verify parameter (default True) that is passed
straight through to httpx. It accepts a bool, a CA-bundle path, or an
ssl.SSLContext:
# Self-signed or internal-CA openQA instance:
client = OpenQAClient(server="openqa.internal", verify="/path/to/internal-ca.pem")
# Disable verification entirely:
client = OpenQAClient(server="openqa.internal", verify=False)
Security warning:
verify=Falsedisables TLS certificate verification and exposes the connection to man-in-the-middle attacks. Use it only against trusted instances on trusted networks; prefer supplying the internal CA bundle instead.
License
GPL-2.0-or-later. See COPYING.
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
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 openqa_async-0.1.0.tar.gz.
File metadata
- Download URL: openqa_async-0.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831c656e986363e3554ed8b82674963fae7e02cdfa16d2f32f3619e50f52e3bc
|
|
| MD5 |
efc42cc85c2e4b5d8ecbd1e4257b59b8
|
|
| BLAKE2b-256 |
253eaa85c4175073241bf29547879c54fd100868998156788a726f068b9081fa
|
Provenance
The following attestation bundles were made for openqa_async-0.1.0.tar.gz:
Publisher:
release.yml on mimi1vx/openqa-async
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openqa_async-0.1.0.tar.gz -
Subject digest:
831c656e986363e3554ed8b82674963fae7e02cdfa16d2f32f3619e50f52e3bc - Sigstore transparency entry: 1675671039
- Sigstore integration time:
-
Permalink:
mimi1vx/openqa-async@ee94bf112533938a68b0f7943355031d035e9631 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mimi1vx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ee94bf112533938a68b0f7943355031d035e9631 -
Trigger Event:
release
-
Statement type:
File details
Details for the file openqa_async-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openqa_async-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d606850d0dcc7df70c9aba0db99eaeba1d42354951f92c2b16902a48c62fe97b
|
|
| MD5 |
44dad35e3a0b72eae51f90ebd04d0739
|
|
| BLAKE2b-256 |
67c42804dc9b9982fda3d98fcd761c23fdabeb8b64848b287044e6f64fc66167
|
Provenance
The following attestation bundles were made for openqa_async-0.1.0-py3-none-any.whl:
Publisher:
release.yml on mimi1vx/openqa-async
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openqa_async-0.1.0-py3-none-any.whl -
Subject digest:
d606850d0dcc7df70c9aba0db99eaeba1d42354951f92c2b16902a48c62fe97b - Sigstore transparency entry: 1675671046
- Sigstore integration time:
-
Permalink:
mimi1vx/openqa-async@ee94bf112533938a68b0f7943355031d035e9631 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mimi1vx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ee94bf112533938a68b0f7943355031d035e9631 -
Trigger Event:
release
-
Statement type: