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])
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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a3cf85894bf89d683436aaaca78f53604bb4a539a3517da93052af523b8da28 |
|
MD5 | 8a4b761a1a474ec324baac2247ac8bfb |
|
BLAKE2b-256 | 842ccb121af27d01dcf36fa4c7aeb47d7bf02ac9b4250fd5d63594e9733009a5 |