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.6.0.tar.gz (19.6 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.6.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.0.tar.gz
  • Upload date:
  • Size: 19.6 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.6.0.tar.gz
Algorithm Hash digest
SHA256 ab155fb5e4c2527e83538b4214e70ec1f4373fc0606e864e9a7576cb502c43d6
MD5 f261dd93902c63cfe21c93aa62ff443d
BLAKE2b-256 5bfc0e5aa21647bb033c899341f5473317aef7aeb4b1209df0a36bbab005eab8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4975ac18cf72ecfc9de78e9c81beef639188290c0a3e7ccfc704326543fea53a
MD5 1df2544483cbda888b514d8fa1f4deda
BLAKE2b-256 f5f081d8dabb0d36c597e8bc1c793197d88181e42665c7aab44937dd0b62ca4a

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