Qase API Client

2.0.6 · active · verified Fri Apr 17

The Qase API Client provides a Python interface for interacting with the Qase TestOps API (v1). It allows programmatic access to manage test cases, test runs, defects, and other TestOps entities. The current version is 2.0.6, and it's part of a larger monorepo with frequent, modular releases across various Qase Python integrations.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Qase API client, configure it with an API token, and then use it to retrieve test cases from a specified project. Ensure your QASE_TOKEN and QASE_PROJECT_CODE environment variables are set or replace the placeholders.

import os
from qaseio.api_client.configuration import Configuration
from qaseio.api_client.api_client import ApiClient
from qaseio.api_client.api.cases_api import CasesApi

QASE_TOKEN = os.environ.get('QASE_TOKEN', 'YOUR_QASE_TOKEN')
QASE_PROJECT_CODE = os.environ.get('QASE_PROJECT_CODE', 'PRJ') # e.g., 'PRJ'

if QASE_TOKEN == 'YOUR_QASE_TOKEN' or QASE_PROJECT_CODE == 'PRJ':
    print("Please set QASE_TOKEN and QASE_PROJECT_CODE environment variables or replace placeholders.")
else:
    try:
        # Configure API key authorization: TokenAuth
        configuration = Configuration(
            host="https://api.qase.io/v1",
            api_key={"TokenAuth": QASE_TOKEN}
        )

        # Create an API client
        with ApiClient(configuration) as api_client:
            # Create an instance of the API you want to use
            cases_api = CasesApi(api_client)

            # Example: Get all cases for a project
            response = cases_api.get_cases(QASE_PROJECT_CODE)
            print(f"Successfully retrieved {len(response.result.entities)} cases.")
            # print(response.to_dict())

    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →