Itz-fork / Gofile2

An API Wrapper for Gofile API
https://pypi.org/project/gofile2
MIT License
27 stars 4 forks source link
gofile gofile-api python-api-wrapper

Gofile2

from gofile2 import Gofile

g_a = await Gofile.initialize()
await g_a.upload("/home/itz-fork/photo.png")
await g_a.done()

An API Wrapper for Gofile API.

About API

Gofile is in BETA version and this API will evolve over time. Check regularly if changes have been made.

Current version is compatible with 2023-04-20

Installation

Install via pypi Downloads

pip3 install gofile2

To install development version Gofile2, run the following command

pip install git+https://github.com/Itz-fork/Gofile2.git

Usage

1. Import Gofile2 in your python file

Asynchronous version

from gofile2 import Gofile

Synchronous version

from gofile2 import Sync_Gofile

2. Create an instance of Gofile2

Asynchronous version

g_a = await Gofile.initialize()

Synchronous version

g_a = Sync_Gofile()

Above code will login as guest account. Keep in mind that only get_server, upload and upload_folder functions works in this mode. If you want to use other functions you will need to have a premium account (as of 2023-04-20) token. If you need to login to your own account then pass your api token as token argument like below code.

g_a = await Gofile.initialize(token="your_gofile_api_token_here")

3. Everything Done! Now Play with it!

# Get current server
await g_a.get_server()

# Upload a folder
await g_a.upload_folder(path="path_to_your_folder")

# Upload a file
await g_a.upload(file="path_to_your_file")

# Get account info
await g_a.get_account()

# Get content details
await g_a.get_content(contentId="id_of_the_file_or_folder")

# Create folder
await g_a.create_folder(parentFolderId="your_root_folder_id", folderName="Folder Name")

# Set options
await g_a.set_option(contentId="id_of_the_contentr", option="your_option", value="your_value")

# Copy file or folder to another folder
await g_a.copy_content(contentsId="id_of_the_file_or_folder", folderIdDest="id_of_the_destination_folder")

# Delete file or folder
await g_a.delete_content(contentsId="id_of_the_file_or_folder")

# After everything, send close Gofile client
await g_a.done()

Docs

Automatically generated on 2024:01:05:13:41:40

Thanks to