Skip to main content

Python client for PMEase QuickBuild

Project description

Build status Docs status Coverage status Version status Downloads status


Package supports sync and async syntax with same code base.

from quickbuild import AsyncQBClient, QBClient

Documentation

Package Read the Docs

Official REST API documentation

Available REST API Clients

Installation

pip3 install quickbuild

Examples

Get server version:

from quickbuild import QBClient

client = QBClient('https://server', 'user', 'password')
version = client.system.get_version()
print(version)

Get server version in async way (be careful AsyncQBClient must be called inside async function):

import asyncio
from quickbuild import AsyncQBClient

async def main():
    client = AsyncQBClient('https://server', 'user', 'password')
    version = await client.system.get_version()
    print(version)
    await client.close()

asyncio.run(main())

Stop build:

from quickbuild import QBClient

client = QBClient('https://server', 'user', 'password')
client.builds.stop(123)

Update credentials handler:

import asyncio
import aiohttp
from quickbuild import AsyncQBClient

async def get_credentials():
    async with aiohttp.ClientSession() as session:
        async with session.get('...') as resp:
            response = await resp.json()
            return response['user'], response['password']

async def main():
    client = AsyncQBClient('http://server', 'user', 'password',
                            auth_update_callback=get_credentials)

    # let's suppose credentials are valid now
    print(await client.builds.get_status(12345))

    # now, after some time, password of user somehow changed, so our callback
    # will be called, new credentials will be using for retry and future here
    # we get also correct build info instead of QBUnauthorizedError exception
    print(await client.builds.get_status(12345))

    await client.close()

asyncio.run(main())

Content type

By default QuickBuild returns XML content, but starting from 10 version it also has native support of JSON content, usually it’s much more convenient to use native Python types (parsed XML) instead of pure XML string.

So, that is why three types of content were indtoduced, this type and behavior can be set globally for client instances, and can be rewritten for some methods.

  • PARSE (using by default)
    • GET: parse XML to native Python types.

    • POST: pure XML string.

  • XML
    • GET: return native XML without any transformations.

    • POST: pure XML string.

  • JSON (QuickBuild 10+)
    • GET: parsed JSON string.

    • POST: dumps object to JSON string.

Development

It’s possible to run QuickBuild community edition locally using docker:

Build locally:

docker build .  -f docker/QB10.Dockerfile -t quickbuild:10
docker run --restart always --name qb10 -d -p 8810:8810 quickbuild:10

Or run prepared image:

docker run --restart always --name qb10 -d -p 8810:8810 pbelskiy/quickbuild:10

Then open http://localhost:8810/

Testing

Prerequisites: tox

Then just run tox, all dependencies and checks will run automatically

tox

Contributing

Feel free for any contributions.

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

quickbuild-0.18.0.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

quickbuild-0.18.0-py3-none-any.whl (65.4 kB view details)

Uploaded Python 3

File details

Details for the file quickbuild-0.18.0.tar.gz.

File metadata

  • Download URL: quickbuild-0.18.0.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for quickbuild-0.18.0.tar.gz
Algorithm Hash digest
SHA256 3cf51fe3a4456bc7c56b9fa5dda8775f8dd6606470ad6b3b55c63a741279e59a
MD5 777237112f5fbd83dbfd24907fcc54d6
BLAKE2b-256 87a0a8fcefa5aab375d2e6ce5a4c6239bee82e1677a9d900093f3c4be58b7f2d

See more details on using hashes here.

File details

Details for the file quickbuild-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: quickbuild-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 65.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for quickbuild-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb3ae88b860abf63f62cd4bc6e595a23f2c19311cfe04d94e8a3f2aa25ca5c67
MD5 c2fb1d217eb9281386c5d98a18da8f8c
BLAKE2b-256 a287381a4d82d89188a900cc727c56a824ea74bf437dd226c2367dc613346f47

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