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.6+
  • requests>=2.32.3
  • requests_ntlm>=1.2.0
  • python-dotenv>=1.0.0

Installation

pip install qrs-api-client

Configuration

You can optionally put the authentication data into an .env file. Just create it in your project folder and initialize the variables listed below.

CERT_PATH="qlik_certs/client.pem"
KEY_PATH="qlik_certs/client_key.pem"
ROOT_CERT_PATH="qlik_certs/root.pem"
SERVER_NAME="<server name>"
SERVER_PORT=4242
USER_ID="<DOMAIN>\\<user_id>"
PASSWORD="<insert password>"

Connecting to Qlik Sense Enterprise Server using certificates

You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in order to authenticate on the server.

Authentication without .env file

from qrs_api_client.client import QRSClient
from qrs_api_client.auth import AuthManager

# Inserts certificates into the authentication manager
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")

# Authenticates on the enterprise server
client = QRSClient(server_name="<server_name>", server_port=4242, auth_manager=auth_manager,
                   auth_method="certificate", verify_ssl=True)

# Calls the API
api_desc_post = client.get("about/api/description", "extended=false&method=POST")
if api_desc_post:
    print(api_desc_post)
else:
    print("API request error.")

Authentication with .env file

from qrs_api_client.client import QRSClient
from dotenv import load_dotenv
import os

# Loads environment variables from .env file.
load_dotenv()

# Authenticates on the enterprise server (Cert paths are called from the .env file)
client = QRSClient(server_name=os.getenv("SERVER_NAME"), server_port=os.getenv("SERVER_PORT"),
                   auth_method="certificate", verify_ssl=True)

# Calls the API
api_desc_post = client.get("about/api/description", "extended=false&method=POST")
if api_desc_post:
    print(api_desc_post)
else:
    print("API request error.")

Connecting to Qlik Sense Enterprise Server using NTLM

Authentication without .env file

from qrs_api_client.client import QRSClient
from qrs_api_client.auth import AuthManager

# Inserts credentials into the authentication manager
auth_manager = AuthManager(user_id="<DOMAIN>\\<user_id>", password="<password>",
                           root_cert_path="<path_to_certificates>/root.pem")

# Authenticates on the enterprise server
client = QRSClient(server_name="<server_name>", server_port=443, auth_manager=auth_manager,
                   auth_method="ntlm", verify_ssl=False)

# Calls the API
api_desc_post = client.get("about/api/description", "extended=false&method=POST")
if api_desc_post:
    print(api_desc_post)
else:
    print("API request error.")

Authentication with .env file

from qrs_api_client.client import QRSClient

# Authenticates on the enterprise server
client = QRSClient(server_name="<server_name>", server_port=443, auth_method="ntlm", verify_ssl=False)

# Calls the API
api_desc_post = client.get("about/api/description", "extended=false&method=POST")
if api_desc_post:
    print(api_desc_post)
else:
    print("API request error.")

Examples of usage

Please click on this link to find examples of usage of this client.

Documentation

Please click on this link for full API reference documentation.

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.0.0.tar.gz (22.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.0.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qrs_api_client-2.0.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for qrs_api_client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dea540d9e18ba7c32bb49f3052665736ce11b9a50fc64bf7b4742e451daa959e
MD5 8d3e3f057d3b91107137469b4367b1ae
BLAKE2b-256 370d291a7de9997e4ed0861fbe446f262d16c1341e5888d91ea87aff46b0c01e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qrs_api_client-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for qrs_api_client-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24a5214fa98f16fb9f1b364586bdda4ddd277d4815ec2b9284f0e0f1aba5f236
MD5 082e7ebf3771db669285545d71b1610c
BLAKE2b-256 34b54bcfe665e25edb90bbfaaa713a65f1a866798d7d5092b773bfb461396966

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