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

Uploaded Python 3

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.1.tar.gz
  • Upload date:
  • Size: 19.7 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.1.tar.gz
Algorithm Hash digest
SHA256 32fae658e0710bf7112a704b0c4da8d13e36dbd54e2c28b8f04a89055b4786f3
MD5 bb8a08354a4a4a8629c0f219ea042640
BLAKE2b-256 ceb16c44d0df2227dcd4602dbc54337d01ff4fd87a3b146a14c62a9445eb8002

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qrs_api_client-2.6.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98e8627395aadef7646b93fccd7747c36e05efc1a937086b42816bcc7819fe70
MD5 1a304beb234e47659738b4e536391f8b
BLAKE2b-256 f71691299727c9c2b72f165f03be28a491b8e4e5ffad867b9145e83b6679fa09

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