Skip to main content

Python client for Qlik Sense Repository Service API.

Project description

qrs-api-client (Qlik Sense Repository API Client)

Python client for Qlik Sense Repository Service API.

Forked from clintcarr/qrspy.

Requirements

  • Python 3.9+
  • requests >= 2.32.3

Optional:

  • requests_ntlm >= 1.2.0 — only required for NTLM authentication

Installation

# Minimal install (certificate authentication only)
pip install qrs-api-client

# With NTLM authentication support
pip install qrs-api-client[ntlm]

Connecting using certificates

Export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder before running the code.

from qrs_api_client import QRSClient, AuthManager

auth_manager = AuthManager(
    cert_path="<path_to_certificates>/client.pem",
    key_path="<path_to_certificates>/client_key.pem",
    root_cert_path="<path_to_certificates>/root.pem",
)

client = QRSClient(
    server_name="<server_name>",
    server_port=4242,
    auth_manager=auth_manager,
    auth_method="certificate",
    verify_ssl=True,
)

about = client.get("/qrs/about/api/description", {"extended": "false", "method": "POST"})
if about:
    print(about)
else:
    print("API request error.")

Connecting using NTLM

Install with the ntlm extra: pip install qrs-api-client[ntlm].

from qrs_api_client import QRSClient, AuthManager

auth_manager = AuthManager(
    user_id="<DOMAIN>\\<user_id>",
    password="<password>",
    root_cert_path="<path_to_certificates>/root.pem",
)

client = QRSClient(
    server_name="<server_name>",
    server_port=443,
    auth_manager=auth_manager,
    auth_method="ntlm",
    verify_ssl=False,
)

about = client.get("/qrs/about/api/description", {"extended": "false", "method": "POST"})
print(about)

Loading configuration from environment variables or .env files

qrs-api-client does not load any configuration automatically. This keeps it a clean, predictable library — you are in full control of where credentials come from.

A common pattern is to store credentials in environment variables or a .env file and load them in your own application code:

pip install python-dotenv
# .env in your project folder (add this to .gitignore!)
QLIK_CERT_PATH=/path/to/client.pem
QLIK_KEY_PATH=/path/to/client_key.pem
QLIK_ROOT_CERT_PATH=/path/to/root.pem
QLIK_SERVER_NAME=qliksense.example.com
QLIK_SERVER_PORT=4242
import os
from dotenv import load_dotenv
from qrs_api_client import QRSClient, AuthManager

load_dotenv()

auth_manager = AuthManager(
    cert_path=os.environ["QLIK_CERT_PATH"],
    key_path=os.environ["QLIK_KEY_PATH"],
    root_cert_path=os.environ["QLIK_ROOT_CERT_PATH"],
)

client = QRSClient(
    server_name=os.environ["QLIK_SERVER_NAME"],
    server_port=int(os.environ["QLIK_SERVER_PORT"]),
    auth_manager=auth_manager,
    auth_method="certificate",
    verify_ssl=True,
)

Any other config source (Vault, AWS Secrets Manager, YAML files, command-line arguments) works the same way — just pass the values into AuthManager() and QRSClient().

Query parameters: dict or string

The HTTP methods accept params as a dict:

client.get("/qrs/about", {"extended": "false"})

Logging

The client uses the standard logging module under the name qrs_api_client.client. To see debug output:

import logging
logging.basicConfig(level=logging.DEBUG)

Examples of usage

See the examples folder.

Documentation

Full API reference: https://rumen-vasilev.github.io/qrs-api-client/

License

MIT — see LICENSE.

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

qrs_api_client-2.5.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qrs_api_client-2.5.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file qrs_api_client-2.5.0.tar.gz.

File metadata

  • Download URL: qrs_api_client-2.5.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for qrs_api_client-2.5.0.tar.gz
Algorithm Hash digest
SHA256 00e152604e046f2f329d3a2f49ec9f5fc98cf7c7e086000559756bf0d7fe29da
MD5 00b5d718b760f24d2ef836307d4d1ae6
BLAKE2b-256 288e8d5044e770a467b6059ff2bae4494d11b1cc71ca7f90e2dd98121175eaf2

See more details on using hashes here.

File details

Details for the file qrs_api_client-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: qrs_api_client-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for qrs_api_client-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88000ab01537608d39a8d838b9c4870fab6a37b248bdeaf48b4f2133a5e14c52
MD5 13fa918421ee41ad186dc9029bccd281
BLAKE2b-256 0322f995fa7c35eb1af1496b5b0e6a3789f8465171ce6e929dc641c6d4300968

See more details on using hashes here.

Supported by

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