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.4.0.tar.gz (14.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.4.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qrs_api_client-2.4.0.tar.gz
  • Upload date:
  • Size: 14.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.4.0.tar.gz
Algorithm Hash digest
SHA256 cc171f7ed00c5e4fb32c1e7ac350a528ec14e681e30e3e140ebc659d298cbbd6
MD5 1582310d93601bbdee2ecc3a8d9285c7
BLAKE2b-256 c6525a7038a1780f7806a69e4d17efc21d4b3b20a5671540a728be9ec611a8fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qrs_api_client-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3dd9b5bda8177df10b06d443da8c79264baa78831037defa8c00f0c2cbe0be4e
MD5 72c59ada017d3b4f5a694f3f2ae75894
BLAKE2b-256 ec190bbedcdcad98e5df32ea9cbe7d6939ff6eade4361688ade43d23e1ce3e44

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