openqa_client
This is a client for the openQA API, based on requests. It requires Python 3.6 or later.
Usage
Here's a simple example of reading the status of a job:
from openqa_client.client import OpenQA_Client
client = OpenQA_Client(server='openqa.opensuse.org')
print(client.openqa_request('GET', 'jobs/1'))
Here's an example of triggering jobs for an ISO:
# This is a Fedora server.
client = OpenQA_Client(server='openqa.happyassassin.net')
params = {}
params['ISO'] = '22_Beta_TC2_server_x86_64_boot.iso'
params['DISTRI'] = 'fedora'
params['VERSION'] = '22'
params['FLAVOR'] = 'server_boot'
params['ARCH'] = 'x86_64'
params['BUILD'] = '22_Beta_TC2'
print(cl.openqa_request('POST', 'isos', params))
You can use data= or json= instead of params=. params= adds
query parameters to the request. data= sends
application/x-www-form-urlencoded data; most endpoints accept this
and it can avoid query string character limits for long requests.
json= sends application/json encoded data; this is required for
POST or PUT requests to the test_suites, machines and
products endpoints.
All methods other than GET require authentication. This client uses
the same configuration file format as the reference (perl) client in
openQA itself. Configuration will be read from /etc/openqa/client.conf
or ~/.config/openqa/client.conf. A configuration file looks like this:
[openqa.happyassassin.net]
key = APIKEY
secret = APISECRET
You can get the API key and secret from the web UI after logging in. Your configuration file may include credentials for multiple servers; each section contains the credentials for the server named in the section title.
If you create an OpenQA_Client instance without passing the server
argument, it will use the first server listed in the configuration file
if there is one, otherwise it will use 'localhost'. Note: this is a
difference in behaviour from the perl client, which always uses 'localhost'
unless a server name is passed.
TLS/SSL connections are the default (except for localhost). You can
pass the argument scheme to OpenQA_Client to force the use of
unencrypted HTTP, e.g.
OpenQA_Client(server='openqa.happyassassin.net', scheme='http').
The API always returns JSON responses; this client's request functions parse the response before returning it.
If you need for some reason to make a request which does not fall into
the openqa_request() method's expected pattern, you can construct a
requests.Request and pass it to do_request(), which will attach the
required headers, execute the request, and return the parsed JSON response.
The const module provides several constants that are shadowed from the
upstream openQA code, including job states, results, and the 'scenario
keys'.
Development
You can file pull requests at Github.
There is an extensive test suite with CI integration. You can run the test
suite locally by running tox. If your system has a tox version earlier
than 3.3.0, you must have the setuptools_scm Python module installed for
this to work correctly, or else you will get errors about a missing
install.requires file.
Licensing
This software is available under the GPL, version 2 or any later version. A copy is included as COPYING. Contributions submitted as pull requests are assumed to be submitted under the same license terms unless otherwise specified.
Metadata
Release files for openqa-client 4.3.1
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 | |
|---|---|---|---|---|
| openqa_client-4.3.1.tar.gz | 35.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openqa_client-4.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.4 kB
Release files / openqa_client-4.3.1.tar.gz
| Download URL | openqa_client-4.3.1.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dd2740c29ad485f62f2e871e732f8405f078b1d283dc2ea90a5a5e74f5bf7ba
|
|
BLAKE2b-256 checksum How to use checksums |
931de3ee9e9160411c25a7eeb720ab812a15d63aa6da48a746aef7e2b741f815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.0rc2
|
Release files / openqa_client-4.3.1-py3-none-any.whl
| Download URL | openqa_client-4.3.1-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e3d5135f581a60dab96b6daef2014d07e68c855a26c4a2f4d27bd9dd32751a1
|
|
BLAKE2b-256 checksum How to use checksums |
f8cc9462ee127a075c4fb116ebb991f603f60ff5037839a71170242fd5250360
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.0rc2
|
Security for openqa-client 4.3.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.