# DDB Python Client

Full documentation of the DDB Python Client, which simplifies access to the DDB API using Python.

Note for external users - many of the links in the following section refer to internal applications. Please speak to your project team for support.

# Prerequisites

  • Requires Python 3.6+

# Installation

To be able to authenticate and download the packages, you will first need to create a virtual environment and install a few packages:

python -m venv .venv
.venv/Scripts/activate

python -m pip install --upgrade pip
pip install keyring artifacts-keyring

You'll then need to create a 'pip.ini'(windows) or pip.conf (Mac/Linux) file in your virtual environment with the following content:

[global]
extra-index-url=https://ovearup.pkgs.visualstudio.com/_packaging/ddb/pypi/simple/

You can install each microservice using pip:

pip install ddb-parameter-service

Avaliable Microservices

  • ddb-comments-service
  • ddb-environment-context-service
  • ddb-parameter-metadata-service
  • ddb-parameter-service
  • ddb-qa-service
  • ddb-reference-data-service
  • ddb-user-service
  • ddb-template-service

You will also need the our authentication package, which you can install using:

pip install git+https://github.com/arup-group/ddbpy_auth.git

Note: This package should only be used by "scripters" if you are an application please ensure you are generating your own access token.

Then import the microservice API and environments from the package as well as the authentication:

from parameter_service import API, ENV
from DDBpy_auth import DDBAuth

# Step by Step Guide

# How to


parameter_service_client_instance = API(
    env = ENV.sandbox,
    token = DDBAuth.acquire_new_access_content()
)

response = parameter_service_client_instance.get_parameters()

# Asynchronous Calls

parameter_service_client_instance = API(
    env = ENV.sandbox,
    token = DDBAuth.acquire_new_access_content(),
    pool_threads = 5
)

thread = parameter_service_client_instance.get_parameters(async_req=True)
response = thread.get()

# Developer Information

The repository is located here (opens new window). You'll be able to see upcoming changes to the package.

Last Updated: 21/06/2024, 11:34:44