Skip to main content

A simple Python library to upload files to anonfile.la

Project description

Anonfile Uploader

Anonfile Uploader is a simple Python library to upload files to Anonfile.la, including its temporary storage feature.

Installation

pip install anonfile-uploader

Use Without Login Example

from anonfile import Anonfile

anonfile = Anonfile()
link = anonfile.upload_file('path/to/your/file.jpg')
print(f"Uploaded File: {link['url']}")

Error Handling

The library comes with built-in exception handling to manage common errors such as timeouts, connection issues, or Json errors, others errors.

from anonfile import Anonfile, TimeoutError, ConnectionError, JsonDecodeError, AnonfileError

uploader = Anonfile(email="your_email@example.com", password="your_password")
try:
    file_path = "path/to/your/file.txt"
    response = uploader.upload_file(file_path)
    print(f"Upload File: response['url']")
except TimeoutError:
    print("The upload took too long and timed out.")
except ConnectionError:
    print("Failed to connect to the server.")
except JsonDecodeError as e:
    print(f"Error: {str(e)}")
except AnonfileError as e:
    print(e)

Handling Timeout

If the upload takes too long and exceeds the specified timeout, a TimeoutError will be raised.

from anonfile import Anonfile, TimeoutError

uploader = Anonfile(email="your_email@example.com", password="your_password")
try:
    link = uploader.upload_file('path/to/your/file.jpg', timeout=10)
    print(f"Uploaded file: {link['url']}")
except TimeoutError:
    print("The upload took too long and timed out.")

Handling Connection Issues

If there's a problem connecting to the anonfile.la , a ConnectionError will be raised.

from anonfile import Anonfile, ConnectionError

uploader = Anonfile(email="your_email@example.com", password="your_password")
try:
    link = uploader.upload_file('path/to/your/file.jpg')
    print(f"Uploaded file: {link['url']}")
except ConnectionError:
    print("Failed to connect to the server.")

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

anonfile_uploader-0.1.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

anonfile_uploader-0.1.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file anonfile_uploader-0.1.4.tar.gz.

File metadata

  • Download URL: anonfile_uploader-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for anonfile_uploader-0.1.4.tar.gz
Algorithm Hash digest
SHA256 db0cd20c0a8ca5822fd0183e24d59852e4b45881e2a4e8da2521def06e5bbca8
MD5 c8d41ee8fe31ca16ff507567c73fc217
BLAKE2b-256 339dce2c74ae0f15448e0d7cfa3700718c73a9287f5f9ab9c564e6d3bf5bad18

See more details on using hashes here.

File details

Details for the file anonfile_uploader-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for anonfile_uploader-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 62216fd34ed08987aca7b9840673c8779d53dc54716c05e264a379d6d234a158
MD5 9dd827cb2b7ace4b8f423a0f46957916
BLAKE2b-256 397b090b34bd8679fb6c2449eecd4d92b020a64d86611d4cdd71366d131dbd09

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