Skip to main content

polarion-rest-api-client

image

A client library for accessing Polarion REST API. This project consists of multiple layers. There is a high level, still incomplete version of the client and a feature complete low level API client, which was generated using an OpenAPI generator. Therefore the OpenAPI Specification of Polarion was used.

Usage of the High Level Client

The high level client is an abstraction of the fine-grained, auto-generated client. It is non project specific, however, for most operations, you need to create a project specific one from the generic one. All created created project clients share the client session of the generic client. To get started, create a client and check, if the project exists. In the end, to get all Work Items of a project with an empty query, you can simply run the following code and our client will automatically take care of the paging:

import polarion_rest_api_client as polarion_api

client = polarion_api.PolarionClient(
   polarion_api_endpoint="http://127.0.0.1/api",
   polarion_access_token="PAT123",
)
project_client = client.generate_project_client("PROJ")
project_exists = project_client.exists() # Should be True
work_items = project_client.work_items.get_all()

During the initialization of the client you can define additional settings like the page size when getting items or the maximum content size when bulk creating new items. Async bulk operations (async_create, async_update, async_delete) execute their prepared batches concurrently. The number of requests that may run at the same time is limited via max_async_in_flight_requests on PolarionClient. In addition, you can define your own Work Item class with custom fields, which become available as attributes on object level instead of being part of the additional_attributes dictionary only. To use this feature, inherit from our Work Item class and pass your extended class when requesting Work Items:

import polarion_rest_api_client as polarion_api
import dataclasses

@dataclasses.dataclass
class CustomWorkItem(polarion_api.WorkItem):
   capella_uuid: str | None = None

client = polarion_api.PolarionClient(
   polarion_api_endpoint="http://127.0.0.1/api",
   polarion_access_token="PAT123",
)
project_client = client.generate_project_client("PROJ")
work_items = project_client.work_items.get_all(work_item_cls=CustomWorkItem)
uuid = work_items[0].capella_uuid # the value of the custom field capella_uuid can be accessed this way

Usage of the autogenerated OpenAPI Client

First, create a client:

from polarion_rest_api_client.open_api_client import Client

client = Client(base_url="https://api.example.com")

If the endpoints you're going to hit require authentication, use AuthenticatedClient instead:

from polarion_rest_api_client.open_api_client import AuthenticatedClient

client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")

Now call your endpoint and use your models:

from polarion_rest_api_client.open_api_client.models import MyDataModel
from polarion_rest_api_client.open_api_client.api.my_tag import get_my_data_model
from polarion_rest_api_client.open_api_client.types import Response

my_data: MyDataModel = get_my_data_model.sync(client=client)
# or if you need more info (e.g. status_code)
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)

Or do the same thing with an async version:

from polarion_rest_api_client.open_api_client.models import MyDataModel
from polarion_rest_api_client.open_api_client.api.my_tag import get_my_data_model
from polarion_rest_api_client.open_api_client.types import Response

my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)

By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.

client = AuthenticatedClient(
    base_url="https://internal_api.example.com",
    token="SuperSecretToken",
    verify_ssl="/path/to/certificate_bundle.pem",
)

You can also disable certificate validation altogether, but beware that this is a security risk.

client = AuthenticatedClient(
    base_url="https://internal_api.example.com",
    token="SuperSecretToken",
    verify_ssl=False
)

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.

Things to know:

  1. Every path/method combo becomes a Python module with four functions:

    1. sync: Blocking request that returns parsed data (if successful) or None
    2. sync_detailed: Blocking request that always returns a Request, optionally with parsed set if the request was successful.
    3. asyncio: Like sync but async instead of blocking
    4. asyncio_detailed: Like sync_detailed but async instead of blocking
  2. All path/query params, and bodies become method arguments.

  3. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)

  4. Any endpoint which did not have a tag will be in polarion_rest_api_client.open_api_client.api.default

Documentation

Read the full documentation.

Installation

You can install the latest released version directly from PyPI.

uv add polarion-rest-api-client

To set up a development environment, clone the project and install it with uv.

git clone https://github.com/dbinfrago/polarion-rest-api-client
cd polarion-rest-api-client
uv sync --extra docs --extra test
uvx pre-commit run --all-files

Updating the auto generated part

To update the auto generated part of the code, execute the open_api_client_build/build_client.py script with path or url as first arg and the path to the OpenAPI-Specification as second arg from the project root directory. The publicly available specification from the Polarion developer Portal was used.

Contributing

We'd love to see your bug reports and improvement suggestions! Please take a look at our guidelines for contributors for details.

Licenses

This project is compliant with the REUSE Specification Version 3.0.

Copyright DB InfraGO AG, licensed under Apache 2.0 (see full text in LICENSES/Apache-2.0.txt)

Dot-files are licensed under CC0-1.0 (see full text in LICENSES/CC0-1.0.txt)

Metadata

Release files for polarion-rest-api-client 2.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polarion-rest-api-client 2.3.2
File Size Uploaded
polarion_rest_api_client-2.3.2.tar.gz 842.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polarion-rest-api-client 2.3.2
File Interpreter ABI Platform
polarion_rest_api_client-2.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.4 MB

Release files / polarion_rest_api_client-2.3.2.tar.gz

Download URL polarion_rest_api_client-2.3.2.tar.gz
Size 842.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bf9f7d73b3e728e249840218edb2abead5021aa8cec2c8b8456c2a3f9de877e6
BLAKE2b-256 checksum
How to use checksums
a3133064ba69ff727ce06068184b55254cc48733a81aa7fec96ed5dbc2c1583c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / polarion_rest_api_client-2.3.2-py3-none-any.whl

Download URL polarion_rest_api_client-2.3.2-py3-none-any.whl
Size 3.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
52af651d69ec9d63bad92de38ddb76810560b0c7f5139377a7ce63ebfd32b679
BLAKE2b-256 checksum
How to use checksums
cd2d8c5cb674a23995a6a04d3cba432900126b389658cb90c9d6dac2b090ac9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

2.3.3

2 release files

This release

2.3.2 This release

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page