Skip to main content

MeowBox — Permanent file hosting uploader (sync & async)

Project description

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

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.4.tar.gz (5.1 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.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meowbox-1.0.4.tar.gz
  • Upload date:
  • Size: 5.1 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.4.tar.gz
Algorithm Hash digest
SHA256 033be4113ec84153a15c79a4cc6810ea7c397079dc018834a5409d10c25c6b14
MD5 ec59d2c9908973f042b98c8b7f814bcb
BLAKE2b-256 f98032f03ddc2a886f521b4139e51ef2bcce2822602807b05cf940082988d77c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meowbox-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a4c86beeb18239d37b43cf52392c92b6269e352b21fbec0a38c83b87ce439b
MD5 06265e11b0104fcba07989b9a2487a7b
BLAKE2b-256 ee6c3c079d254535d0fe18076ed031349476d2d8bd87d3a52891ec4982ac287e

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