![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Catbox Uploader is a simple Python library to upload files and URLs to Catbox.moe, including its temporary storage feature, Litterbox, and album management.
pip install catbox-uploader
CatboxUploader supports using a userhash directly. You can pass the userhash
when initializing the CatboxUploader
and use it for authenticated uploads and album management.
from catbox import CatboxUploader
uploader = CatboxUploader(userhash='your_userhash_here')
from catbox import CatboxUploader
uploader = CatboxUploader()
link = uploader.upload_file('path/to/your/file.jpg')
print(f'Uploaded file: {link}')
Litterbox allows you to upload files for a temporary period, after which the files will be deleted automatically. Use the upload_to_litterbox
method to upload files with a specified expiration time.
Available expiration times:
1h
: 1 hour12h
: 12 hours24h
: 24 hours72h
: 3 dayslink = uploader.upload_to_litterbox('path/to/your/file.jpg', time='24h')
print(f'Uploaded file (available for 24 hours): {link}')
You can upload multiple files as an album to Catbox.moe using the upload_album
method. This allows you to upload several files at once, and it will return the links for all uploaded files.
file_paths = ['file1.jpg', 'file2.jpg', 'file3.jpg']
links = uploader.upload_album(file_paths)
for link in links:
print(f'Uploaded file link: {link}')
You can create an album with uploaded files, a title, and a description using the create_album
method:
album_shortcode = uploader.create_album(file_links, "My Album", "This is a test album")
print(f"Album created: https://catbox.moe/c/{album_shortcode}")
You can edit an album by changing its title, description, or the files it contains:
uploader.edit_album(album_shortcode, file_links, "Updated Album Title", "Updated description")
You can delete an album by its shortcode:
uploader.delete_album(album_shortcode)
The library comes with built-in exception handling to manage common errors such as timeouts, connection issues, or HTTP errors.
If the upload takes too long and exceeds the specified timeout, a TimeoutError
will be raised.
from catbox import CatboxUploader, TimeoutError
uploader = CatboxUploader(userhash='your_userhash_here')
try:
link = uploader.upload_file('path/to/your/file.jpg', timeout=10)
print(f'Uploaded file: {link}')
except TimeoutError:
print("The upload took too long and timed out.")
If there's a problem connecting to the Catbox.moe or Litterbox server, a ConnectionError
will be raised.
from catbox import CatboxUploader, ConnectionError
uploader = CatboxUploader(userhash='your_userhash_here')
try:
link = uploader.upload_file('path/to/your/file.jpg')
print(f'Uploaded file: {link}')
except ConnectionError:
print("Failed to connect to the server.")
In case of HTTP errors (such as 404 or 500), an HTTPError
will be raised.
from catbox import CatboxUploader, HTTPError
uploader = CatboxUploader(userhash='your_userhash_here')
try:
link = uploader.upload_file('path/to/your/file.jpg')
print(f'Uploaded file: {link}')
except HTTPError as he:
print(f"HTTP error occurred: {he}")
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A simple Python library to upload files and URLs to Catbox.moe
We found that catbox-uploader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.