Distorage Python Documentation


The first way: a public Discord hosting server

The upload method

from distorage import CommonServer
host = CommonServer()

file_key = host.upload("the/path/to/the/your/file")  # Returns your access key to the file you uploaded

You can store this key in a database and at each execution run a for on a list of keys

The download method

from distorage import CommonServer

host = CommonServer()
file_key = ...  # key returned by the upload method

host.download(file_key=file_key, save_path="the/path/to/the/new/file")

The edit method

from distorage import CommonServer

host = CommonServer()
file_key = ...  # key returned by the upload method

host.edit(file_key=file_key, file_path="the/path/to/the/edited/file")

The delete method

from distorage import CommonServer

host = CommonServer()
file_key = ...  # key returned by the upload method

host.delete(file_key=file_key)

The second way: a private Discord hosting server

The upload method

import os
from distorage import CustomServer

host = CustomServer(bot_token=os.environ.get("BOT_TOKEN"))
channel_id = ...  # Discord channel id where you want the file to be sent

file_key = host.upload("the/path/to/the/your/file", channel_id=channel_id)  # Returns your access key to the file you uploaded

You can store this key in a database and at each execution run a for on a list of keys

The download method

import os
from distorage import CustomServer

host = CustomServer(bot_token=os.environ.get("BOT_TOKEN"))
file_key = ...  # key returned by the upload method

host.download(file_key=file_key, save_path="the/path/to/the/new/file")

The edit method

import os
from distorage import CustomServer

host = CustomServer(bot_token=os.environ.get("BOT_TOKEN"))
file_key = ...  # key returned by the upload method

host.edit(file_key=file_key, file_path="the/path/to/the/edited/file")

The delete method

import os
from distorage import CustomServer

host = CustomServer(bot_token=os.environ.get("BOT_TOKEN"))
file_key = ...  # key returned by the upload method

host.delete(file_key=file_key)