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.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-2.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meowbox-2.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-2.4.tar.gz
Algorithm Hash digest
SHA256 52ae9e549436dae6c9c5bdcdac6f5e33cd6ad8baedf92d41f9719bceabf602bf
MD5 97dc2630bea3063d837382a56707dae6
BLAKE2b-256 19a9a0d784177b7d37cee83cf8bd14af9831dd7afebbf27a8e973616214dfc2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meowbox-2.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-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc81f6cf787a4dd441f2ce896eaaeb5c541babb9e6c090f717acad430e130b4
MD5 8d2f6673be24b24473da7cf1413908f4
BLAKE2b-256 66e9b1867d69ab8da77cd594755736cff941104cf36b0e2b54a396a82ff93fb5

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