Skip to main content

The token and service implementation of sciebo RDS

Project description

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.

Available Modules

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

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

research-data-services-common-0.7.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

research_data_services_common-0.7-py2.py3-none-any.whl (11.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file research-data-services-common-0.7.tar.gz.

File metadata

  • Download URL: research-data-services-common-0.7.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.8.5

File hashes

Hashes for research-data-services-common-0.7.tar.gz
Algorithm Hash digest
SHA256 1b964589230373c344cf87939c0880ef084b7b39e1d02ecb31d4e484767cc2a7
MD5 14c60befdd681cac0021c889cb898a50
BLAKE2b-256 b72ac94b6ef73b5bfc07257e1f1fa30b9508f86b7862a04123be720d87cacc28

See more details on using hashes here.

File details

Details for the file research_data_services_common-0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: research_data_services_common-0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.8.5

File hashes

Hashes for research_data_services_common-0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e340ed63e190b32b83c6d1f4cded9c4e2445a56a6c1f703286da72a4b6ea8f6e
MD5 d6d55912ffa81a49e8eb588ef733ed2a
BLAKE2b-256 af143c0907da770eb4fb3ea164f7ed7e53005c2ef5314c178815bcff5c3317ff

See more details on using hashes here.

Supported by

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