Skip to main content

MeowBox — Permanent file hosting uploader (sync & async)

Project description

MeowBox Python Library 📦

Permanent file hosting — files never expire. By @BadmundaXd | GitHub

Python library for uploading files to MeowBox — supports both sync and async.


Install

pip install meowbox

Quick Start

Sync upload

from meowbox import upload

urls = upload("photo.jpg")
print(urls[0])
# https://files.tgvibes.online/AbCdEfGh.jpg

Async upload (httpx)

from meowbox import upload_async

urls = await upload_async("photo.jpg")
print(urls[0])

Class-based

from meowbox import MeowBox

mb = MeowBox()

# Sync
urls = mb.upload("photo.jpg")

# Async
urls = await mb.upload_async("photo.jpg")

Upload multiple files

from meowbox import upload

urls = upload(["file1.jpg", "file2.mp4", "file3.pdf"])
for url in urls:
    print(url)

Upload file object (e.g. Telegram Bot)

from meowbox import upload_async

path = await message.download()
urls = await upload_async(path)
await message.reply(urls[0])

Telegram Bot Example

from meowbox import upload_async
import os

async def upload_handler(message):
    if not message.reply_to_message or not message.reply_to_message.media:
        await message.reply("Reply to a file!")
        return

    path = await message.reply_to_message.download()
    try:
        urls = await upload_async(path)
        await message.reply(f"✅ {urls[0]}")
    except Exception as e:
        await message.reply(f"❌ Upload failed: {e}")
    finally:
        if os.path.exists(path):
            os.remove(path)

Exceptions

Exception When
UploadError Upload failed (server error)
RateLimitError Too many uploads
MeowBoxException Base exception
from meowbox import upload
from meowbox.exceptions import UploadError, RateLimitError

try:
    urls = upload("file.jpg")
except RateLimitError as e:
    print(f"Slow down! Retry after {e.retry_after}s")
except UploadError as e:
    print(f"Upload failed: {e}")

API Reference

upload(f, base_url=...) -> list[str]

Sync upload. f = path, file object, or list of either.

upload_async(f, base_url=...) -> list[str]

Async upload using httpx.

MeowBox(base_url=...)

Class with .upload() and .upload_async() methods.


Links

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

meowbox-1.0.0.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.

meowbox-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file meowbox-1.0.0.tar.gz.

File metadata

  • Download URL: meowbox-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for meowbox-1.0.0.tar.gz
Algorithm Hash digest
SHA256 809938129d3c44c7fd4bbaa0c8806e6398b72a30f7c52c181634d773c39dced9
MD5 cda7c221ad84fb74395b96cb23b39472
BLAKE2b-256 6851cf005014a10fdd0e8bddf6cfee0b3808760d4c87b45bf2e1861c7ccf7cf9

See more details on using hashes here.

File details

Details for the file meowbox-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: meowbox-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for meowbox-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30b03aeaf36a69402d543e0ee6f29e47b53aacd3c202c9f63f1ee842fc01d4bf
MD5 7565d770356f6157311318eea5e980db
BLAKE2b-256 49eb7dd0505a2f86e620982bf7f40244ee745d78ca734513d6e6532907c01fce

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