Skip to main content

meowbox

permanent file hosting — files never expire. by badmunda · github

a python library for uploading files to meowbox. supports both sync and async out of the box.


install

pip install meowbox

how to use

basic sync upload

from meowbox import upload

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

async upload

from meowbox import upload_async

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

class-based usage

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 from a file object

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)

error handling

exception when
UploadError upload failed (server error)
RateLimitError too many requests
MeowBoxException base exception class
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

method description
upload(f, base_url=...) sync upload — accepts path, file object, or list
upload_async(f, base_url=...) async upload using httpx
MeowBox(base_url=...) class with .upload() and .upload_async() methods

links

telegram channel

Metadata

Release files for meowbox 2.5

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

Source distribution (sdist)

Source distribution for meowbox 2.5
File Size Uploaded
meowbox-2.5.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 12.5 kB

Release files / meowbox-2.5.tar.gz

Download URL meowbox-2.5.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
05e48a4c20225070afac650a2b00e36973bc1bceef55e405c045369ff3934161
BLAKE2b-256 checksum
How to use checksums
cfe0a008661ef21c8a7e4798dad1ca48db377e528781437336ac2fb852338218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / meowbox-2.5-py3-none-any.whl

Download URL meowbox-2.5-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab5074bd4192da03ce8b85af65e517bdd1fc32e24e95553a4b8b413a1d99840a
BLAKE2b-256 checksum
How to use checksums
a2fda2bafd0bc62b23ffa60e7b994ab70f4e396ca9522cae49d73383a1a785bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

2.5 This release

2 release files

2.4

2 release files

1.5

2 release files

1.0.4

2 release files

1.0.1

2 release files

1.0.0

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