Skip to main content

A simple http request file downloader.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getfiles-0.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getfiles-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file getfiles-0.0.1.tar.gz.

File metadata

  • Download URL: getfiles-0.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for getfiles-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e916c478e5079f6ffabb0e8b50a0fb30e5056ee3c778d9c3fa772ebd18527869
MD5 874f4a093bb0fba7ef6be113be1e4f85
BLAKE2b-256 b7217b2fe37ba7cc1aecd4fe5e734c4ca3952d3a70c474027c7f5a7711ce4354

See more details on using hashes here.

File details

Details for the file getfiles-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: getfiles-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for getfiles-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 536bc30076321ee7ef210223488c53337af6c13ede34f04af8a460cfb16e85e0
MD5 679daf4cd80d2763951a866e3cdee410
BLAKE2b-256 6adc720d5b00e591791e2ea4b2409258e21dd408ec53e593fa7fe0cf923553d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page