Skip to main content

Python wrapper around the different PriceCypher APIs

Project description

PriceCypher Python SDK

Python wrapper around the different PriceCypher APIs.

Usage

Installation

Simply execute pip install pricecypher-sdk

Dataset SDK

from pricecypher import Datasets

datasets = Datasets(BEARER_TOKEN)

datasets.index()
datasets.get_meta(DATASET_ID)
datasets.get_scopes(DATASET_ID)
datasets.get_scope_values(DATASET_ID, SCOPE_ID)
datasets.get_transaction_summary(DATASET_ID)

columns = [
    {'name_dataset': 'cust_group', 'filter': ['Big', 'Small'], 'key': 'group'},
    {'representation': 'cost_price', 'aggregate': 'sum', 'key': 'cost_price'}
]
datasets.get_transactions(DATASET_ID, AGGREGATE, columns)

Config SDK

from pricecypher import ConfigSections

config = ConfigSections(BEARER_TOKEN, DATASET_ID)

# Print available config sections
print(config.index())
# Print config key-value pairs for `monitoring` section.
print(config.get_parsed_section('monitoring'))
# Non-existent config section returns empty dict.
print(config.get_parsed_section('nonexistent'))

Contracts

The Script, ScopeScript, and QualityTestScript abstract classes can be extended with their abstract methods implemented to create scripts usable in other services.

The ScopeScript in particular is intended for scripts that calculate values of certain scopes for transactions.

The QualityTestScript is intended for scripts that check the quality of a data intake and produce a standardized output that can be visualized and/or used by other services.

See the documentation on the abstract functions for further specifics.

Environment variables

Variable Description
CUSTOM_DNS_DOMAIN Use for custom domain resolution of (wildcard) domain to $CUSTOM_DNS_IP.
CUSTOM_DNS_IP IP address the CUSTOM_DNS_DOMAIN should resolve to.
SSL_VERIFY Boolean value to specify whether SSL certificates should be verified.

Development

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Python >= 3.9

Setup

The endpoints module models the different PriceCypher API endpoints. Each file represents a different API and the contents of each file are structured into the different endpoints that are provided by the API. Similarly, each file in the models module defines the models that are provided by the different APIs.

The SDK that this package provides is contained in the top-level package contents.

Deployment

  1. Execute python3 -m build to build the source archive and a built distribution.
  2. Execute python3 -m twine upload dist/* to upload the package to PyPi.

Authors

  • Marijn van der Horst - Initial work
  • Pieter Voors - Contracts for Script and ScopeScript

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pricecypher-sdk-1.0.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pricecypher_sdk-1.0.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file pricecypher-sdk-1.0.0.tar.gz.

File metadata

  • Download URL: pricecypher-sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pricecypher-sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d6b54d85a260e06cbbca55b37b3ac1baabf6edebcff20e04f8123d8283059335
MD5 21c83867fc89e6111398dca16d525335
BLAKE2b-256 a41d6279f013df4320c458d1fddc747c12aad90f1261253ac06330bf42b09fa9

See more details on using hashes here.

File details

Details for the file pricecypher_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pricecypher_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6027183edfa880180224d5a6a7167444f140072f29961d26e260f21a21ce50
MD5 b137088a41dd69546bf8ac825c7aed1f
BLAKE2b-256 620621bc721a55290d0a5972d77aa774573d3d78e89eea9ebc5d1aa1af4ece00

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