OSDU API Client
Project description
Introduction
osdu-client
is a python library implementing a simple OSDU client. With abstracted out authorization backend.
Instalation
pip install osdu-client
Example
OSDU API client can be adjusted to specific OSDU deployment by defining auth backend according to AuthBackendInterface
methods.
from typing import AnyStr, Dict
from osdu_client import OSDUAPI
from osdu_client.auth import AuthBackendInterface
class AuthBackend(AuthBackendInterface):
def __init__(self, headers, base_url) -> None:
self._headers = headers
self._base_url = base_url
def get_headers(self) -> Dict:
return self._headers
def get_base_url(self) -> AnyStr:
return self._osdu_base_url
def get_sd_connection_params(self, log_level: int = None) -> Dict:
return {}
auth_backend = AuthBackend(
headers={"Authorization": "Bearer XYZ"},
base_url="https://exmaple.com"
)
storage_client = OSDUAPI.client('storage', auth_backend=auth_backend)
response = storage_client.get_record_versions(id="123")
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
osdu_client-0.2.0.tar.gz
(8.2 kB
view hashes)
Built Distribution
Close
Hashes for osdu_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72650b6d1bb5564a7735c38b1569e3c97e34a5a4d957f3fd5c64a443397fc653 |
|
MD5 | 9bf51c0db180c2c2452c9c7b222bf879 |
|
BLAKE2b-256 | 28ace11fa4bcd47d542bf29f6a0cbc9e605097d47b87ff7b61ac78c75ac0dc36 |