A Python client for ODMF's REST-API
Project description
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 .
Installation
From PyPI (current version): 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
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
Built Distribution
Hashes for odmfclient-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec08c311e2ab7827b3601dde5d8a4a6a117a866346f6e83994ecc08281d06b2 |
|
MD5 | 6117e3e0eb40f375dbc29afb741b068c |
|
BLAKE2b-256 | b0d161a0b76a726f78c2078706725063c5d9a439261bbbdcd97efe770e8e78a8 |