Skip to content

jlu-ilr-hydro/odmfclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI GitHub GitHub last commit

API client for ODMF

This package allows programatic access to ODMF databases with Python. It is based on requests.

The code is found on Github under a free license GitHub.

Installation

From PyPI (current version): PyPI using pip

pip install odmfclient

In an IPython console (eg in Spyder) you can use the same command with

%pip install odmfclient

To install the newest version from github do:

pip install https://github.com/jlu-ilr-hydro/odmfclient/archive/main.zip

For other branches then main use the above command as .../archive/<branch>.zip

Usage

Direct access to ODMF

from odmfclient import login
with login('https://path/to/odmf', 'user', 'password') as api:
    print(api)
    # Get all datasets at site #1 with valuetype 1
    datasets = api.dataset.list(site=1, valuetype=1)
    # Get values for the first dataset found as pandas.DataFrame
    df = api.dataset.values_parquet(dsid=datasets[0])
    # Upload some content to a file in the ODMF-file manager
    api.upload(b'Some binary content, usually what you load from a file', targetpath='path/to/file', overwrite=True)

Access ODMF behind an reverse proxy requiring authentification

At JLU, we are protecting our ODMF instances behind a reverse proxy (Apache) requiring basic authentification for access from outside the universities network using shared credentials. Of course, any other authentification at your reverse proxy with a requests method is possible. To access such an instance, where the shared credentials for basic authentification is basic-user and basic-password:

from odmfclient import login
from requests.auth import HTTPBasicAuth

basic_auth = HTTPBasicAuth('basic-user', 'basic-password')

with login('https://path/to/odmf', 'user', 'password', session_auth=basic_auth) as api:
    print(api)
    # Get all datasets at site #1 with valuetype 1
    datasets = api.dataset.list(site=1, valuetype=1)
    # Get values for the first dataset found as pandas.DataFrame
    df = api.dataset.values_parquet(dsid=datasets[0])

About

A client to the REST-API of odmf

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages