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
File details
Details for the file odmfclient-0.1.2.tar.gz
.
File metadata
- Download URL: odmfclient-0.1.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | feb0cadb8a1f3506d055738a7ca5ad3a287b4c59b2f9cbbec5fef00cd9b503e9 |
|
MD5 | 18ac1eb0a0b79a17d7a2f166e7366fbf |
|
BLAKE2b-256 | b9c75e657fdfdf7e906660c1cf4e8a02f2271843bcad33c16c503fc807cb8185 |
File details
Details for the file odmfclient-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: odmfclient-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec08c311e2ab7827b3601dde5d8a4a6a117a866346f6e83994ecc08281d06b2 |
|
MD5 | 6117e3e0eb40f375dbc29afb741b068c |
|
BLAKE2b-256 | b0d161a0b76a726f78c2078706725063c5d9a439261bbbdcd97efe770e8e78a8 |