Skip to main content

Simple File Downloader

A lightweight Python utility for downloading files from the internet with:

  • Automatic filename detection
  • Extension-aware saving
  • Generic filename fallback
  • Duplicate filename prevention

This package provides a single, simple function:

download(url, output_dir)

Features

  • Preserves file extensions correctly
  • Generates a generic filename if none is detected
  • Prevents filename duplication by auto-incrementing
  • Minimal dependency design
  • Easy to integrate into any project

📥 Installation

pip install getfiles

Or install locally:

git clone https://github.com/nattkorat/getfiles.git
cd getfiles
pip install .

Usage

from getfiles import downloader

url = "https://example.com/file.pdf"
output_dir = "./downloads"

downloader.download(url, output_dir)

How It Works

When downloading a file:

  1. The package tries to extract the file extension from:

    • The URL path
    • The Content (if available URL path failed)
  2. Filename generation:

    • A generic name using uuid4 is generated

This guarantees no overwriting and no duplicates.


Function Signature

download(url: str, output: str) -> str

Parameters

Parameter Type Description
url str The URL of the file to download
output str Directory where the file will be saved

Returns

  • str: Full path of the downloaded file

Design Philosophy

This package is intentionally simple:

  • One function
  • No complex configuration
  • Safe file handling
  • Production-friendly behavior

It is ideal for:

  • Data collection scripts
  • Web scraping pipelines
  • Automation tools
  • ML dataset downloading
  • CLI utilities

License

MIT License

Metadata

Release files for getfiles 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for getfiles 0.0.1
File Size Uploaded
getfiles-0.0.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for getfiles 0.0.1
File Interpreter ABI Platform
getfiles-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / getfiles-0.0.1.tar.gz

Download URL getfiles-0.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e916c478e5079f6ffabb0e8b50a0fb30e5056ee3c778d9c3fa772ebd18527869
BLAKE2b-256 checksum
How to use checksums
b7217b2fe37ba7cc1aecd4fe5e734c4ca3952d3a70c474027c7f5a7711ce4354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / getfiles-0.0.1-py3-none-any.whl

Download URL getfiles-0.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
536bc30076321ee7ef210223488c53337af6c13ede34f04af8a460cfb16e85e0
BLAKE2b-256 checksum
How to use checksums
6adc720d5b00e591791e2ea4b2409258e21dd408ec53e593fa7fe0cf923553d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page