{"id":10180,"library":"qase-api-client","title":"Qase API Client","description":"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.","status":"active","version":"2.0.6","language":"en","source_language":"en","source_url":"https://github.com/qase-tms/qase-python","tags":["API client","testing","Qase","TestOps","QA"],"install":[{"cmd":"pip install qase-api-client","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The top-level package for the API client is 'qaseio', not 'qase'.","wrong":"from qase.api_client.configuration import Configuration","symbol":"Configuration","correct":"from qaseio.api_client.configuration import Configuration"},{"note":"The 'ApiClient' class is nested within the 'api_client' submodule, not directly under the package root.","wrong":"from qaseio.api_client import ApiClient","symbol":"ApiClient","correct":"from qaseio.api_client.api_client import ApiClient"},{"note":"Example for a specific API endpoint client; other API clients are similarly structured under 'qaseio.api_client.api'.","symbol":"CasesApi","correct":"from qaseio.api_client.api.cases_api import CasesApi"}],"quickstart":{"code":"import os\nfrom qaseio.api_client.configuration import Configuration\nfrom qaseio.api_client.api_client import ApiClient\nfrom qaseio.api_client.api.cases_api import CasesApi\n\nQASE_TOKEN = os.environ.get('QASE_TOKEN', 'YOUR_QASE_TOKEN')\nQASE_PROJECT_CODE = os.environ.get('QASE_PROJECT_CODE', 'PRJ') # e.g., 'PRJ'\n\nif QASE_TOKEN == 'YOUR_QASE_TOKEN' or QASE_PROJECT_CODE == 'PRJ':\n    print(\"Please set QASE_TOKEN and QASE_PROJECT_CODE environment variables or replace placeholders.\")\nelse:\n    try:\n        # Configure API key authorization: TokenAuth\n        configuration = Configuration(\n            host=\"https://api.qase.io/v1\",\n            api_key={\"TokenAuth\": QASE_TOKEN}\n        )\n\n        # Create an API client\n        with ApiClient(configuration) as api_client:\n            # Create an instance of the API you want to use\n            cases_api = CasesApi(api_client)\n\n            # Example: Get all cases for a project\n            response = cases_api.get_cases(QASE_PROJECT_CODE)\n            print(f\"Successfully retrieved {len(response.result.entities)} cases.\")\n            # print(response.to_dict())\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Explicitly install `qase-api-client` via `pip install qase-api-client`. Do not assume `pip install qase-python` will install this client (it's not a package).","message":"The `qase-python` GitHub repository is a monorepo containing multiple packages (e.g., `qase-api-client`, `qase-api-v2-client`, `qase-pytest`, `qase-robotframework`). Ensure you install `qase-api-client` specifically if you intend to use the base API client, as other packages may have different dependencies or purposes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When initializing `Configuration`, pass your Qase API Token like this: `api_key={'TokenAuth': 'your_token_here'}`.","message":"Authentication uses an 'API Token' which is mapped to `api_key` in the generated client's `Configuration` object. The parameter name for the Qase API is `TokenAuth`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always refer to the official Qase documentation or the specific API client's README to confirm which client (v1 or v2) corresponds to the API endpoints you intend to use. Install `qase-api-v2-client` if targeting the v2 API.","message":"Qase has both `qase-api-client` (v1) and `qase-api-v2-client` (v2) packages. While they currently share the same version number (2.0.x) in the monorepo, they target different API versions. Using the wrong client for a specific API version can lead to unexpected behavior or missing functionality.","severity":"breaking","affected_versions":"2.0.0+"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Change your import statements from `from qase...` to `from qaseio...`. For example: `from qaseio.api_client.configuration import Configuration`.","cause":"Incorrect top-level package name. The Qase API client is installed under the `qaseio` namespace.","error":"ImportError: No module named 'qase.api_client'"},{"fix":"Verify your Qase API Token in your Qase TestOps account settings. Ensure it's correctly passed in the `Configuration` object: `api_key={'TokenAuth': 'YOUR_VALID_TOKEN'}`.","cause":"The provided API token is invalid, expired, or missing. Or, the token does not have the necessary permissions for the requested operation.","error":"qaseio.api_client.exceptions.ApiException: (401) Unauthorized"},{"fix":"Instantiate the relevant API client class using the `ApiClient` object: `cases_api = CasesApi(api_client)`. Then call methods on `cases_api`, e.g., `cases_api.get_cases(...)`.","cause":"You are trying to call an API method directly on the `ApiClient` instance. The `ApiClient` is a low-level HTTP client; specific API operations are exposed through dedicated API client classes (e.g., `CasesApi`, `RunsApi`).","error":"AttributeError: 'ApiClient' object has no attribute 'cases_api'"}]}