Garnajee 99827e6d20 Merge pull request #2 from NohamR/main
Refactor CLI and client for improved structure and error handling
2025-12-13 16:51:46 +01:00
2025-12-10 16:41:21 +01:00
2025-12-10 16:27:27 +01:00
2025-12-13 15:49:42 +01:00

GofilePy

Build and Release

A Python library and CLI tool for Gofile.io. It supports the free API tiers, streaming uploads (low memory usage for large files), and script-friendly JSON output.

Features

  • Streaming Uploads: Upload 100GB+ files without loading them into RAM.
  • Download Support: Download files from Gofile URLs or content IDs.
  • Folder Management: Upload to specific folders or create new ones automatically.
  • Script Ready: JSON output mode for easy parsing in pipelines.
  • Free Tier Support: Handles Guest accounts and Standard tokens.
  • Progress Bar: Visual feedback for long uploads and downloads.

Installation

From Source

  1. Clone the repository:
git clone https://github.com/garnajee/gofilepy.git && cd gofilepy
  1. Install via uv:
uv sync
  1. Running the CLI
uv run gofilepy --help
  1. (Optional) Install the package in your environment
uv pip install .

Usage (CLI)

Basic Upload

Upload a single file. A new public folder will be created automatically if you don't provide one.

gofilepy video.mp4

Upload with Token

Export your token (Get it from your Gofile Profile) to access your account storage.

export GOFILE_TOKEN="your_token_here"
gofilepy my_file.zip

Upload to a Specific Folder

If you have an existing folder ID:

gofilepy -f "folder-uuid-123" image.png

Group Upload (Single Folder)

Upload multiple files. The first file creates a folder, and the rest are uploaded into it.

gofilepy -s part1.rar part2.rar part3.rar

Download Files

Download files from a Gofile URL or content ID.

Download from URL:

gofilepy -d https://gofile.io/d/GxHNKL

Download from content ID:

gofilepy -d GxHNKL

Download to specific directory

gofilepy -d GxHNKL -o ./downloads

Scripting Mode (JSON Output)

Use --json to suppress human-readable text and output a JSON array.

gofilepy --json file.txt
# Output: [{"file": "file.txt", "status": "success", "downloadPage": "...", ...}]

Verbose Mode

Debug connection issues or API responses.

gofilepy -vv big_file.iso

Usage (Library)

You can use gofilepy in your own Python scripts.

Upload Files

from gofilepy import GofileClient

client = GofileClient()
# client = GofileClient(token="YOUR_TOKEN_HERE")  # Optional token for private uploads
file = client.upload(file=open("./test.py", "rb"))
print(file.name)
print(file.page_link)  # View and download file at this link

Download Files

from gofilepy import GofileClient

client = GofileClient()
contents = client.get_contents("GxHNKL")
print("Folder contents:")
print(contents)

Development

For contributors and developers:

  1. Install with development dependencies:
uv sync --extra dev
  1. Run pylint to check code quality:
uv run pylint src/gofilepy
  1. Install in editable mode for development:
uv pip install -e .

Building for Release

To build a .whl (Wheel) file and a source distribution:

  1. Install build tools:
    pip install build
    
  2. Run build:
    python -m build
    
  3. Artifacts will be in dist/.

License

This project is licensed under the MIT License.

Description
No description provided
Readme MIT 92 KiB
Languages
Python 100%