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.1.tar.gz (4.7 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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meowbox-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 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.1.tar.gz
Algorithm Hash digest
SHA256 f8cb7f338be3c45b77f4d0fe806fb7067b092e213eee7d42051c9e6b3ce74cf7
MD5 c2c646d7e058b527673cb3170f2fa83a
BLAKE2b-256 b0fb22daa5c949b0ae61050962a974d70a48381534baeb0dc957d010a02ccb92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meowbox-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8fad41ca428f4ebb324dba163d67f1b44b50e4afe58ea23dbfd8ea48534dbb
MD5 2bb8992d4856fe97041ae136073bf9c8
BLAKE2b-256 0ed97fad64951371392426bf027d62417260bf60a53880980d85e686372a00d9

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