Introduction

This projects aims at providing unified and easy-to-use Python library for communicating with the Data Stewardship Wizard API. For more info about the DSW project itself, see official webpage or the API documentation.

Installation

You can install this library via PyPI:

pip install dsw-sdk

Quickstart

The only mandatory step need in order to get going is to initialize the whole SDK and tell it, where is the DSW API located and how to connect to it:

dsw_sdk = DataStewardshipWizardSDK(
   api_url='http://localhost:3000',
   email='albert.einstein@example.com',
   password='password',
)

Now you are ready to go.

Note

Note that this is only illustrative example and we encourage you not to store secrets like passwords in the source code. There are better mechanisms (env variables) introduced later in this documentation.

Basic usage

Most actions should be done via the high-level interfaces provided on an instance of the DataStewardshipWizardSDK class. These interfaces operate with subclasses of Model class (e.g. User) – these are the DSW data entities. Basically they are just data classes with bunch of attributes and methods for saving the entity (save()) on the server and deleting it (delete()).

user = dsw_sdk.users.create_user(
   first_name='John',
   last_name='Doe',
   email='john.doe@example.com',
)
user.password = os.getenv('SECRET_PASSWORD')
user.save()

...

user.delete()

For more advanced usage, see the next sections.

Indices and tables