Skip to main content

A collection of scripts to easily use the API of OCD Datalake

Project description

 ____        _        _       _          ____            _       _ 
|  _ \  __ _| |_ __ _| | __ _| | _____  / ___|  ___ _ __(_)_ __ | |_ ___
| | | |/ _` | __/ _` | |/ _` | |/ / _ \ \___ \ / __| '__| | '_ \| __/ __|
| |_| | (_| | || (_| | | (_| |   <  __/  ___) | (__| |  | | |_) | |_\__ \
|____/ \__,_|\__\__,_|_|\__,_|_|\_\___| |____/ \___|_|  |_| .__/ \__|___/
                                                          |_|

datalake

Datalake scripts

How to use

Installation

With Python 3.6+:

$ pip install datalake-scripts
$ pip3 install datalake-scripts

Using as a library

see the following link

Using as a CLI

The cli can be used with:

$ ocd-dtl <command> <parameter>

Check ocd-dtl -h for help, including the list of commands available.

You can also use a script directly by using the following command: <script_name> <script_options>.

/!\ Make sure to use utf-8 without BOM when providing a file (-i option)

Environment variables

Authentication

There are two methods of authentication:

  • The first one is the use of the username and password. Every request to the API, will then use fresh tokens periodically created with these credentials.
  • The second one is the use of a long term token. You can create long term token through the GUI, it can have more restricted permissions than your account. You can create several long term tokens for one account.

In case you don't want to enter credentials for each commands and you are on a secured terminal, set those variables:

  • OCD_DTL_LONGTERM_TOKEN a long term token associated to your Datalake account. Please note that if this variable is set, then the long term token will be used for every request to the Datalake API, even if you set the username and passsword environment variables below. This is important because some endpoints / requests do not accept long term tokens but need fresh tokens (ie a Datalake instance with username and password). Check for the need of fresh tokens in each endpoint description here

or

  • OCD_DTL_USERNAME email address used to login on Datalake API/GUI.
  • OCD_DTL_PASSWORD password used to login on Datalake API/GUI.

These last two are independent and one can be used without the other if you wish.

Throttling

For throttling the request, those two environment variable can be used:

  • OCD_DTL_QUOTA_TIME define, in seconds, the time before resetting the requests limit, default is 1 second.
  • OCD_DTL_REQUESTS_PER_QUOTA_TIME define the number of request to do at maximum for the given time, default is 5 queries.

Please don't exceed the quota marked here for each endpoint

Cli parameters

Parameters common and optional for all commands:

--debug display more information for debugging purposes
-e to change the environment {preprod, prod}, default is prod
-o will set the output file as the API gives it.
-q will quiet the verbosity of the program (but still show errors / warnings)

For information about each command and more, please check the documentation directory

Contributing

To develop on this repository, please refer to this file

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

datalake-scripts-2.7.3.tar.gz (66.3 kB view details)

Uploaded Source

Built Distribution

datalake_scripts-2.7.3-py3-none-any.whl (91.3 kB view details)

Uploaded Python 3

File details

Details for the file datalake-scripts-2.7.3.tar.gz.

File metadata

  • Download URL: datalake-scripts-2.7.3.tar.gz
  • Upload date:
  • Size: 66.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for datalake-scripts-2.7.3.tar.gz
Algorithm Hash digest
SHA256 ddb996f67e5fddd6c5591c059ee1f85d6f658aa4748d58fa8d8e0a50cd4e1123
MD5 d63f69d3b4e5c30d7b354a23272ec66d
BLAKE2b-256 0ef108fb5540c840f41224e19fbd1103fc50b7c2f4a57925b630953bddacab91

See more details on using hashes here.

File details

Details for the file datalake_scripts-2.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for datalake_scripts-2.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bcdc63e6a11a8e0c23bb6ebfb192ad154c7147cd7afab0adfb7c84d42b787503
MD5 7779ee19b9fac4295d59448e5ec5b02f
BLAKE2b-256 fca1350f09c5444b03dd82fe26a9cd9f5dc5d997014327eb4f29bbcce94bbcb8

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