### Installing Gofilepy Library Source: https://github.com/m0bb1n/gofilepy/blob/master/README.md This command demonstrates how to install the gofilepy library using pip, the standard package installer for Python. ```bash pip install gofilepy-api ``` -------------------------------- ### Managing Gofile Content with Gofilepy (Premium User) Source: https://github.com/m0bb1n/gofilepy/blob/master/README.md This comprehensive Python example demonstrates various operations available to premium users, including client initialization with a token, accessing account info, retrieving folder content, creating folders, setting options, reloading folder data, copying content, uploading and downloading files, and deleting items. ```python from gofilepy import GofileClient from gofilepy.options import FileOption, FolderOption from gofilepy.exceptions import GofileAPIAuthenticationError client = GofileClient(token="") #Get token from gofile.io. print(client.account.email) print(client.account.tier) root_folder_id = client.account.root_id root = client.get(root_folder_id) child = client.create_folder("NEW_FOLDER", parent_id=root.content_id) child.set_option(FolderOption.DESCRIPTION, "New folder created with gofilepy") #More options available https://gofile.io/api child.set_option(FolderOption.TAGS, ["example", "gofilepy"]) # Registering changes to local variable child.content_id in root.children_ids # = false because it hasn't been updated root.reload() #Gets any new changes/updates to the folder child.content_id in root.children_ids # = true after root folder has been reloaded # Copying content (files & folders) child.copy_to(child.parent_id) #Duplicates folder in same directory root.reload() #Now root.children_ids has another id #uploading & downloading files f = child.upload("./test.txt") #uploads file to newly created "child" folder f.set_option(FileOption.HAS_DIRECT_LINK, True) #Must be set to true to download using gofilepy direct_link = f.create_direct_link() print(direct_link) #or f.direct_links[0] path = f.download("./") #downloads file to local dir print(path) #function returns full path of downloaded file #Deleting content child.delete() #Deletes folder f.delete() #Deletes file ``` -------------------------------- ### Uploading File with Gofilepy (Free User) Source: https://github.com/m0bb1n/gofilepy/blob/master/README.md This Python snippet shows how to initialize the GofileClient without an API token and upload a local file. It then prints the uploaded file's name and public page link. ```python from gofilepy import GofileClient client = GofileClient() #Free users can this function file = client.upload(file=open("./test.txt", "rb")) print(file.name) print(file.page_link) #View and download file at this link ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.