OneDataApiModule


To be able to use the SDK in ONE DATA the SDK needs to be initialized. It is possible to either pass the desired base url and verification to its constructor or use one of its provided methods.

The methods return the initialized SDK out of the current context. This means the URL of the used ONE DATA instance, and the current user will be used for initialization.

Provided Methods

Method Documentation

OneDataApiConstructor

Description

Creates a new OneDataApi. Either

  • username and password or
  • a token needs to be specified to be able to handle authorization successfully.

Other optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis) can be specified.

Parameters

PropertyTypeRequiredDefaultDescription
base_urlstrTrue-base url of your ONEDATA instance
usernamestrFalseNonename of the user
passwordstrFalseNonepassword of the user
tokenstrFalseNoneauth token of the user

Usage

### Creation of the ONE DATA Api ###
onedata_api = OneDataApi(base_url=<base_url>, username=<user>,
                         password=<password>, verify=False, timeout=999)

fromRequest

Description

This can be used as an auto-constructor in ONE DATA Functions.

Creates an instance of OneDataApi from the given req. The keys od_base_url and od_authorization are expected to be in the passed req.

Returns: OneDataApi

Parameters

PropertyTypeRequiredDefaultDescription
reqdicttrue-the request parameter provided by a ONE DATA Function

Usage

onedata_api= OneDataApi.from_request(req)

fromGlobals

Description

This can be used as an auto-constructor in ONE DATA Python Processors.

Creates an instance of the OneDataApi from given globals. The keys od_base_url and od_authorization are expected to be in the passed globals.

Returns: OneDataApi

Parameters

PropertyTypeRequiredDefaultDescription
globalsdicttrue-dictionary containing global variables. globals() can be passed, or a custom dict can be created.

Usage

onedata_api = OneDataApi.from_globals(globals())