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.2.tar.gz (20.0 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.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.2.tar.gz
  • Upload date:
  • Size: 20.0 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.2.tar.gz
Algorithm Hash digest
SHA256 91040d32b5153daba8885733c318760073e39021d668615ca563908524a92c78
MD5 059483188860aab6641b97e8cc3bb035
BLAKE2b-256 9ef36df30483599f58f60048cf9242efddcb36514bb0bfd26b285f26eabf9e3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.2-py3-none-any.whl
  • Upload date:
  • Size: 19.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8113ef3934439913a3b98835694bfb9e59deb788522c9ef74c24e514a8b1164
MD5 df5a4ad6ea155e2c532bd1a2d7dd529d
BLAKE2b-256 d62ccdb41e5f94faa97972a268e163e7a1132a95da949ff3d5cafe82734b2834

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