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
- OneDataApi constructor
- fromRequest (for Functions)
- fromGlobals (for Python Processors)
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
Property | Type | Required | Default | Description |
---|---|---|---|---|
base_url | str | True | - | base url of your ONEDATA instance |
username | str | False | None | name of the user |
password | str | False | None | password of the user |
token | str | False | None | auth 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
Property | Type | Required | Default | Description |
---|---|---|---|---|
req | dict | true | - | 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
Property | Type | Required | Default | Description |
---|---|---|---|---|
globals | dict | true | - | dictionary containing global variables. globals() can be passed, or a custom dict can be created. |
Usage
onedata_api = OneDataApi.from_globals(globals())