gofile

Module and tool to upload files to gofile.io
git clone https://code.alwayswait.ing/gofile
Log | Files | Refs

commit e9a1369504d09d9ad14c205d55c3199801923605
parent f8b32ef5a92fc362a1beb12a2f1a581a63594de7
Author: archiveanon <>
Date:   Mon, 23 Jun 2025 15:03:21 +0000

Remove upload folder selection

While still avaialble on the backend, this is no longer present in
the current API docs.

Diffstat:
Msrc/gofile/api.py | 25++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/gofile/api.py b/src/gofile/api.py @@ -5,7 +5,6 @@ import collections import enum import io import pathlib -import random from typing import Any, AsyncIterator, Generic, Iterator, Optional, TypeVar # normally I'd prefer using standard modules but streaming POST data is really important @@ -108,16 +107,6 @@ async def _gofile_api_post(*args, type: type[T], **kwargs) -> T: return result.data -async def get_upload_server() -> GofileServerResult: - server_list = await _gofile_api_get( - "https://api.gofile.io/servers", type=GofileServerListResult - ) - - if not server_list.servers: - return GofileServerResult() - return random.choice(server_list.servers).to_base_server() - - async def upload_single( file: io.FileIO, token: Optional[str] = None, @@ -134,14 +123,10 @@ async def upload_single( :param folder_id: Folder to upload to. If not specified, the returned ``GofileUpload.result.parent_folder`` should be used for subsequent uploads to the same folder. - :param server: A specific subdomain to upload to. + :param server: No longer used. Previously specified a specific subdomain to upload to. """ # we return a GofileUpload instead of a GofileUploadResult so there's consistency between upload_single / upload_multiple - if not server: - upload_server_result = await get_upload_server() - server = upload_server_result.server - # automatically shorten long file names in small terminals (e.g. split panes) while True: try: @@ -156,9 +141,7 @@ async def upload_single( post_data["folderId"] = folder_id upload_result = await _gofile_api_post( - f"https://{server}.gofile.io/contents/uploadfile", - files=post_data, - type=GofileUploadResult, + "https://upload.gofile.io/uploadfile", files=post_data, type=GofileUploadResult ) break except httpx.HTTPError as e: @@ -179,10 +162,6 @@ async def upload_multiple( """ first_file, *other_files = files - if not server: - upload_server_result = await get_upload_server() - server = upload_server_result.server - first_upload = await upload_single(first_file, token, folder_id, server) if not token: