Skip to main content

MaintainabilityTest CoveragePyPI version

Research Data Services Common Package

This package make the most common modules in Sciebo RDS available in one place, so we do not have to maintain them in several places. In the RDS project, we use OAuth2 for authentication between numerious services, so we need a datastructure with methods, which supports this.

So this package implement 3 basic classes (User, Service, Token), which handles standard user-password authentication. If you need this classes with oauth2-support, you have to use the corresponding version (e.g. Service => Oauth2Service). (Notice: User does not have an oauth2-version, because token takes care of password or token and service takes care of everything else for oauth2.)

Usage

You can find some examples to use this package below. If you need more, please take a look into the tests or sciebo RDS (e.g. Token Storage).

from RDS import User
user1 = User("Max Mustermann")

Installation

pip install research-data-services-common

Optional dependencies

If you want to work with flask, you can use some additional features, when it is installed.

pip install "research-data-services-common[flask]"

JSONEncoder

With flask installed, you can use the JSONEncoder for flask.

from flask import Flask, jsonify
from RDS import Util

app = Flask(__name__)
app.json_encoder = Util.get_encoder(func_name="to_dict")

class Storage():
    def to_dict(self):
        return {"foo": "bar"}

@app.route("/")
def hello():
    return jsonify(Storage())

If you want to use builtin json, you do not need flask. Then you can use monkeypatch-method.

from RDS import Util
import json

class Storage():
    def to_dict(self):
        return {"foo": "bar"}

Util.monkeypatch(func_name="to_dict")

print(json.dumps(Storage())) # expects: '{"foo":"bar"}'

Notice: func_name defaults to to_json.

Monkeypatch JSONEncoder in Flask

If you want to monkeypatch json and flask, you can use the helper function monkeypatch from RDS.

from RDS import Util
Util.monkeypatch()

If it runs in a flask app context, it patches the app by itself. Otherwise you have to set the app-argument.

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

from RDS import Util
Util.monkeypatch("getDict", app=app)

The first argument in the previous example, you can see how to set the method, which should be used for json encoding from your object. The monkeypatch-method patches JSONEncoder in your python installation and your app flask.

RO-Crate Parser

This helps you to work with ro-crate-metadata files. Take a look in the tests to see, how this can be used.

Available Modules

  • User
  • Service (Oauth2Service)
  • Token (Oauth2Token)
  • ROParser

Metadata

Release files for research-data-services-common 0.54

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for research-data-services-common 0.54
File Size Uploaded Provenance Actions
research-data-services-common-0.54.tar.gz 19.9 kB Without provenance Details for research-data-services-common-0.54.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for research-data-services-common 0.54
File Interpreter ABI Platform Actions
research_data_services_common-0.54-py2.py3-none-any.whl Python 3, Python 2 none any Details for research_data_services_common-0.54-py2.py3-none-any.whl

Total release size: 37.1 kB

Release files / research-data-services-common-0.54.tar.gz

Download URL research-data-services-common-0.54.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d27ec77f8db9524cc3ca59d76dcb52ce05aaf375e87167770d667bd6d40b799f
BLAKE2b-256 checksum
How to use checksums
0743a5bd7ec1221fb9cb7ecaa8be191f0595148dd6abc7c2eeb14cf01ae50f1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / research_data_services_common-0.54-py2.py3-none-any.whl

Download URL research_data_services_common-0.54-py2.py3-none-any.whl
Size 17.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
078b01748922e6b001fef091174b9593a653f1aa9add97b128f25da776399a66
BLAKE2b-256 checksum
How to use checksums
4c86a03fedc726a57b62654ba88d29b9fd20b537586727ab244f97a0fef1903e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for research-data-services-common 0.54

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.54 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page