Skip to main content

Django package for using the QRonos Python Client

Project description

qronos-django

Django package for using the QRonos Python Client

Installation

This package can be installed via pip:

pip install qronos-django

Add to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "qronos_django",
    ...
]

Required Settings

QRONOS_HOST

Default: "dev.qronos.xyz"

The URL host of the QRonos instance.

QRONOS_USER

Default: ""

The username with which to authenticate.

QRONOS_PASSWORD

Default: ""

The password with which to authenticate.

Optional Settings

QRONOS_TOKEN_CACHE_KEY

Default: "QRONOS_TOKEN"

The name of the cache key for Tokens

QRONOS_TOKEN_CACHE_FRACTION

Default: 0.8

What fraction of the total lifetime of tokens to cache. Set to 0 to disable Token caching.

QRONOS_LOGGING

Default: True

Create QRonosImportLog items in the Database to track the triggered QRonos Imports

QRONOS_ID_LOGGING

Default: False

Store the tracker/stage ID's in the QRonosImportLog items

QRONOS_DATA_LOGGING

Default: False

Store the data sent in the QRonosImportLog items

Example Usage

from qronos_django.imports import tracker_import, stage_import, delete_items
from qronos_django.tasks import update_qronos_log_status

# Import Tracker (Item) Data
# If QRONOS_LOGGING enabled then this will create a QRonosImportLog item and return it, otherwise returns None
import_log = tracker_import(
    tracker_id=24,
    unique_columns=["Part Number", "Weight"], 
    can_add_item=True,
    can_delete_item=False,
    data=[{"Part Number": "A1", "Weight": 5}, {"Part Number": "A2", "Weight": 8}],
)

# Import Stage Data
# If QRONOS_LOGGING enabled then this will create a QRonosImportLog item and return it, otherwise returns None
import_log = stage_import(
    stage_id=2,
    data=[{"Part Number": "A1", "leadtime": 5}, {"Part Number": "A2", "actual": "2020-10-26"}],
)

# Import Stage Data by Tracker Stage
# If QRONOS_LOGGING enabled then this will create a QRonosImportLog item and return it, otherwise returns None
import_log = stage_import(
    tracker_stage_id=2,
    data=[{"Part Number": "A1", "leadtime": 5}, {"Part Number": "A2", "actual": "2020-10-26"}],
)

# Delete Items
# If QRONOS_LOGGING enabled then this will create a QRonosImportLog item and return it, otherwise returns None
import_log = delete_items(
    tracker_id=2, 
    data=["A", "B"],
)

# Update (and return) status of a single QRonos Import Log.  Can pass optional qronos parameter if you already have a QRonosClient object.
status = import_log.update_import_status()

# (Async) Update Status of a set of QRonos Import Logs (note use QRonosImportLog ids, not job ids)
update_qronos_log_status.delay([125, 233])

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

qronos_django-1.2.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

qronos_django-1.2.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file qronos_django-1.2.1.tar.gz.

File metadata

  • Download URL: qronos_django-1.2.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for qronos_django-1.2.1.tar.gz
Algorithm Hash digest
SHA256 ae4842c0fa47b9fe46a6518dba08b2f504a8bb65810f69676a8805c829a5ea08
MD5 be3e986a4182c7272db5487e144b766a
BLAKE2b-256 40cdc4745fa3e8fd60d9f6c66e491598770f7e7664a6c8657bdc674df5c62d89

See more details on using hashes here.

File details

Details for the file qronos_django-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qronos_django-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3bfe512e7fbb877c97ea1b7539751fb87c0743439312d123b074a8bd12039d9
MD5 50017b800d4c8cb64741400346633d73
BLAKE2b-256 b5e0f5fe8c63070a5295b5ee31ef4c04e8c419a5dec9f89d08535c8052ced413

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page