Python API wrapper for Snipp
Project description
snipp-py
A Python wrapper for the Snipp API.
Installation
pip install snipp-py
Or install from source:
pip install .
Quick Start
from snipp import SnippClient
client = SnippClient(api_key="YOUR_API_KEY")
# Get your own profile
me = client.get_user()
# Upload a file
result = client.upload("screenshot.png", privacy="unlisted")
# List your uploads
uploads = client.list_uploads()
# Delete an upload
client.delete_upload("a3f7b2c91d4e8f0612ab34cd56ef7890.png")
# Browse public uploads
public = client.discover()
Error Handling
All API errors raise SnippError with status and message attributes:
from snipp import SnippClient, SnippError
client = SnippClient(api_key="YOUR_API_KEY")
try:
user = client.get_user("unknown_id")
except SnippError as e:
print(e.status) # HTTP status code
print(e.message) # Error message from the API
API Reference
SnippClient(api_key)
Create a client. The key is sent via the api-key header on every request.
get_user(user_id="@me", include_posts=None, posts_limit=None)
Fetch a user profile. Pass "@me" (default) for the authenticated user. Set include_posts=True and posts_limit (1--50) to include their posts.
upload(file, privacy="unlisted")
Upload a file. file can be a path string, raw bytes, or an open file object. privacy must be "public", "unlisted", or "private".
list_uploads()
List the authenticated user's recent uploads.
delete_upload(filename)
Delete an upload by its filename.
discover()
Browse public uploads.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snipp-1.0.0.tar.gz.
File metadata
- Download URL: snipp-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7dc603413c6cfe2f73ecf2647b62c58468ff4c46a2736af2e61f3143827d4ae
|
|
| MD5 |
9d2dab725544ca95c46c025d69cc22c0
|
|
| BLAKE2b-256 |
ce03cfed680a3256f1b67d01711605c3547057b35eb8616dff5f96313c501124
|
File details
Details for the file snipp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: snipp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a86acead42abdeabd51fd31c0c3cba92a12ddb2fb02eacc5ca312bafd2ddce2e
|
|
| MD5 |
c71a6d6fbaf47acbedd834d540d92040
|
|
| BLAKE2b-256 |
e3ac83a6be4d7b96be42363e963ff492fa242a9a144d2ab9d49f011dddb562b5
|