Skip to main content

A Python client for ODMF's REST-API

Project description

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])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odmfclient-0.1.2.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

odmfclient-0.1.2-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page