Skip to main content

Python client library for openQA API

Project description

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))

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'.

Licensing

This software is available under the GPL, version 2 or any later version. A copy is included as COPYING.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openqa_client-4.1.2.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

openqa_client-4.1.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file openqa_client-4.1.2.tar.gz.

File metadata

  • Download URL: openqa_client-4.1.2.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for openqa_client-4.1.2.tar.gz
Algorithm Hash digest
SHA256 e4c14c9a1bf47454991f8b173366ab3fd29726b83dd97920c3bfbc4d20a5b3a5
MD5 2b55348ae8fe7f2d535060bc8142b890
BLAKE2b-256 aeacc2119c5164d6575ec20ddf65e9621d94672d6705e67f1630d2517ca7c85e

See more details on using hashes here.

File details

Details for the file openqa_client-4.1.2-py3-none-any.whl.

File metadata

  • Download URL: openqa_client-4.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for openqa_client-4.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a49ba2441038d35310672a2bf90bfa67ac5add46aa6efd446a7106148adb7f47
MD5 89195ed8c2ff95e4c86033bffeb39cb2
BLAKE2b-256 33b3386635149e461c610d0098bd921fedfb40c49d02257ef0dfa9916c165062

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page