Metadata-Version: 2.1
Name: osdu-client
Version: 1.4.0
Summary: OSDU API Client
Author: Michal Murawski
Author-email: mmurawski777@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
Requires-Dist: requests (>=2.0.0,<3.0.0)
Description-Content-Type: text/markdown

# 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 osdu_client import OSDUAPI
from osdu_client.auth import AuthBackendInterface


class AuthSession(AuthBackendInterface):
    base_url = "https://base.url"
    default_data_partition_id = "osdu"
    
    authorization_header = {"Authorization": "Bearer access_token"}

    def get_sd_connection_params(self):
        return {}


auth_backend = AuthSession(
    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")

```
# Available services

```python
from osdu_client.client import OSDUAPI
OSDUAPI.print_available_services()
```

```bash
|      Name      |    Versions    |
===================================
|    dataset     |     latest     |
|  entitlements  |     latest     |
|      file      |     latest     |
|    indexer     |     latest     |
|     legal      |     latest     |
|  notification  |     latest     |
|   partition    |     latest     |
|     policy     |     latest     |
|      pws       |     latest     |
|      rafs      |     v1, v2     |
|    register    |     latest     |
|     schema     |     latest     |
|      sdms      |     latest     |
|     search     |     latest     |
|     secret     |     latest     |
|    storage     |     latest     |
|    wellbore    |     v2, v3     |
|  welldelivery  |     latest     |
```


