Package: gofile2
Gofile2fromgofile2importGofileg_a=awaitGofile.initialize()awaitg_a.upload("/home/itz-fork/photo.png")awaitg_a.done()An API Wrapper for Gofile API.About APIGofile is in BETA version and this API will evolve over time. Check regularly if changes have been made.Current version is compatible with2023-04-20InstallationInstall via pypipip3installgofile2To install development versionGofile2, run the following commandpipinstallgit+https://github.com/Itz-fork/Gofile2.gitUsage1. ImportGofile2in your python fileAsynchronous versionfromgofile2importGofileSynchronous versionfromgofile2importSync_Gofile2. Create an instance of Gofile2Asynchronous versiong_a=awaitGofile.initialize()Synchronous versiong_a=Sync_Gofile()Above code will login as guest account. Keep in mind that onlyget_server,uploadandupload_folderfunctions works in this mode. If you want to use other functions you will need to have a premium account (as of2023-04-20) token. If you need to login to your own account then pass your api token astokenargument like below code.g_a=awaitGofile.initialize(token="your_gofile_api_token_here")3. Everything Done! Now Play with it!# Get current serverawaitg_a.get_server()# Upload a folderawaitg_a.upload_folder(path="path_to_your_folder")# Upload a fileawaitg_a.upload(file="path_to_your_file")# Get account infoawaitg_a.get_account()# Get content detailsawaitg_a.get_content(contentId="id_of_the_file_or_folder")# Create folderawaitg_a.create_folder(parentFolderId="your_root_folder_id",folderName="Folder Name")# Set optionsawaitg_a.set_option(contentId="id_of_the_contentr",option="your_option",value="your_value")# Copy file or folder to another folderawaitg_a.copy_content(contentsId="id_of_the_file_or_folder",folderIdDest="id_of_the_destination_folder")# Delete file or folderawaitg_a.delete_content(contentsId="id_of_the_file_or_folder")# After everything, send close Gofile clientawaitg_a.done()Docsinitialize (token: Optional[str] = None) -> GofileCreate a Gofile2 objecttoken: Optional[str]- The access token of an account. Can be retrieved from the profile page_api_request (method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[FormData] = None, need_token: bool = True) -> Dict[str, Any]Make an API request to Gofile servermethod: str- The HTTP method to use for the requestendpoint: str- The API endpoint to requestparams: Optional[Dict[str, Any]]- The query parameters to include in the requestdata: Optional[FormData]- The form data to include in the requestneed_token: bool- Whether a token is required for the requestvalidate_token (token: str) -> NoneValidate gofile tokentoken: str- The token to validateget_server () -> strGet the best server available to receive filesget_account () -> Dict[str, Any]Get information about the accountget_content (contentId: str) -> Dict[str, Any]Get information about the contentcontentId: str- The ID of the file or folderupload (file: str, folderId: str) -> Dict[str, Any]Upload a file to Gofile serverfile: str- Path to file that want to be uploadedfolderId: str- The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a tokenupload_folder (path: str, folderId: Optional[str] = None, delay: int = 3) -> List[Dict[str, Any]]Upload a folder to Gofile serverpath: str- Path to folder that you want to be uploadedfolderId: Optional[str]- The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a tokendelay: int- Time interval between file uploads (in seconds)create_folder (parentFolderId: str, folderName: str) -> NoneCreate a new folderparentFolderId: str- The parent folder IDfolderName: str- The name of the folder that wanted to createset_option (contentId: str, option: str, value: str) -> NoneSet an option on a contentcontentId: str- The content IDoption: str- Option that you want to set. Can be "public", "password", "description", "expire" or "tags"value: str- The value of the option to be defined.copy_content (contentsId: str, folderIdDest: str) -> NoneCopy one or multiple contents to another foldercontentsId: str- The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)folderIdDest: str- Destination folder IDdelete_content (contentsId: str) -> NoneDelete one or multiple files/folderscontentsId: str- The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)done () -> NoneClose the sessionAutomatically generated on 2024:01:05:13:41:40Thanks togofile- Base Project & Inspiration ❤️ (Gofile2is a Re-built version of this)Itz-fork(me) - For Fixing & Improving this project