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-2.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

meowbox-2.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for meowbox-2.5.tar.gz
Algorithm Hash digest
SHA256 05e48a4c20225070afac650a2b00e36973bc1bceef55e405c045369ff3934161
MD5 eaa9e825a2e89d08431ffce8c8e9e040
BLAKE2b-256 cfe0a008661ef21c8a7e4798dad1ca48db377e528781437336ac2fb852338218

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for meowbox-2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ab5074bd4192da03ce8b85af65e517bdd1fc32e24e95553a4b8b413a1d99840a
MD5 5417604251b565c63b349ef51b6cf0ed
BLAKE2b-256 a2fda2bafd0bc62b23ffa60e7b994ab70f4e396ca9522cae49d73383a1a785bd

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