Skip to main content

DRACOON API wrapper in Python

Project description

DRACOON-PYTHON-API

Python connector to DRACOON API
Explore the docs »
Report Bug

Table of Contents

About The Project

Disclaimer: this is an unofficial repo and is not supported by DRACOON
This package provides a connector to DRACOON API. DRACOON is a cloud storage product / service (SaaS) by DRACOON GmbH (http://dracoon.com). DRACOON API documentation can be found here (Swagger UI): https://dracoon.team/api/

Built With

Getting Started

To get started, create a virtual environment in Python and install the dracoon package:

virtualenv <DIR>
source <DIR>/bin/activate 
python3 -m pip install dracoon

Prerequisites

You will need a working Python 3 installation - check your version:

  • Python
python3 --version

Installation

  1. Install the package from PyPi
python3 -m pip install dracoon

Usage

Import required modules

from dracoon import core, users

Modules are named after API endpoints (see documentation for further details).
Exception: core module - this is required to create Dracoon object and to send authenticated requests to the API.

Object creation

my_dracoon = core.Dracoon(clientID, clientSecret)
my_dracoon.set_URLs(baseURL)

Please note: providing a client secret is optional (in order to use with OAuth apps that don't have one).

  • clientID; please register your OAuth app or use dracoon_legacy_scripting
  • clientSecret; please register your OAuth app or use dracoon_legacy_scripting
  • baseURL: Your DRACOON URL instance (e.g. https://dracoon.team)

Authentication

login_response = my_dracoon.basic_auth(username, password)

Please note: you can only authenticate if OAuth app is correctly configured. Only local accounts can be used via password flow.

Send requests

  1. First you will need to build a request with specific parameters:
r = users.get_users(offset=0, filter=f)

Please note:

  • GET requests are limited to returning 500 items. Therefore all such requests contain an offset parameter (default is 0)
  • Providing a filter is optional - see API documentation and examples on usage
  • Sorting not implemented - sorting results should occur via client
  1. you can then send the request as an authenticated user
user_response = my_dracoon.get(r)

Supported request types:

  • GET (object.get(request))
  • POST (oject.post(request))
  • PUT (object.put(reqest))
  • DELETE (object.delete(request))

For examples, check out the example files:

Send async requests

  1. First you will need to build a request with specific parameters:
r = users.get_users(offset=0, filter=f)

Please note:

  • GET requests are limited to returning 500 items. Therefore all such requests contain an offset parameter (default is 0)
  • Providing a filter is optional - see API documentation and examples on usage
  • Sorting not implemented - sorting results should occur via client
  1. you will need to call async requests inside an async function (e.g. main()) and pass a client session
         async with aiohttp.ClientSession() as session:
             user_response = await my_dracoon.async_get(r, session)

Supported request types:

  • GET (object.async_get(request, session))
  • POST (oject.async_post(request, session))
  • PUT (object.async_put(reqest, session))
  • DELETE (object.async_delete(request, session))

For examples, check out the example file:

Roadmap

  • Implement workflows (based on examples - e.g. user csv import, log csv export, file upload)
  • Implement CLI for workflows
  • Implement refresh token storage
  • Update examples to async

License

Distributed under the Apache License. See LICENSE for more information.

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

dracoon-0.3.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

dracoon-0.3.0-py2-none-any.whl (16.8 kB view details)

Uploaded Python 2

File details

Details for the file dracoon-0.3.0.tar.gz.

File metadata

  • Download URL: dracoon-0.3.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for dracoon-0.3.0.tar.gz
Algorithm Hash digest
SHA256 897215dd0b149e6ea03f695ad8ece79c741a1566e39eec32ed55865e1f4ef870
MD5 a3b292f9a425cc48bbf1d37ee3430ec3
BLAKE2b-256 5bfd35fbe789cd846df7a193c0092e73e9a7fdef8b67d994250e6171bbe89601

See more details on using hashes here.

File details

Details for the file dracoon-0.3.0-py2-none-any.whl.

File metadata

  • Download URL: dracoon-0.3.0-py2-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for dracoon-0.3.0-py2-none-any.whl
Algorithm Hash digest
SHA256 d2ed43dffcf35c7e8b340419c6834a0d5bd1b761986186206ac0eb9d0215e7d9
MD5 f0306bbdd737c9e27db45c3cf3369651
BLAKE2b-256 27e5c3d05ddb5b9c6a9a28e182747a9ca60ce358fcf520c7beffc7c80099fc0b

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