Metadata-Version: 2.1
Name: osdu-client
Version: 0.2.6
Summary: OSDU API Client
Home-page: https://github.com/micmurawski/osdu-client/
Author: Michal Murawski
Author-email: mmurawski777@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.7,<4.0
Description-Content-Type: text/markdown
License-File: LICENSE

# Introduction

[![pypi](https://img.shields.io/pypi/v/osdu-client.svg)](https://pypi.org/project/osdu-client/)

`osdu-client` is a python library implementing a simple OSDU client with an 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.



```python
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")

```

