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
- 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
Password flow
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.
Authorization code flow
print(my_dracoon.get_code_url())
auth_code = 'Your auth code' # input('Enter auth code:')
login_response = my_dracoon.oauth_code_auth(username, password)
Please note: you can only authenticate if OAuth app is correctly configured. You will need a custom app with authorization code enabled and you will need to set your redirect uri to https://your.domain.com/oauth/callback
Send requests
- 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
- 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:
- DRACOON authentication
- Export user list to CSV
- Import users from CSV
- Export room permissions to CSV
- Export room log to CSV
- Upload files (generate room logs for root rooms and upload them to target room)
- Create personal rooms
- Bulk update file metadata (epiration example)
- Bulk room config (recycle bin period example)
- Convert folders into rooms with inheritance
Send async requests
- 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
- 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.
Metadata
Release files for dracoon 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dracoon-0.4.1.tar.gz | 20.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dracoon-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.9 kB
Release files / dracoon-0.4.1.tar.gz
| Download URL | dracoon-0.4.1.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cde6f3eef16627bd9429e84462e4c3b7894d0eda4f3864fdc813b3b9724e4b0d
|
|
BLAKE2b-256 checksum How to use checksums |
9b0b2e9c74a3cace1da8c47948649d836c2619ded24f42375d03b87e724fd735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / dracoon-0.4.1-py3-none-any.whl
| Download URL | dracoon-0.4.1-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1108d416bdfd3313699b2b96f8b6fc6c6bf2ac3a4e13c90fe4f26f4874dce184
|
|
BLAKE2b-256 checksum How to use checksums |
1f3683d8b679b1187d1eeb471b11bb65a08dcff00bfbde4aba48934e91ff6d17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|