snipp
A Python wrapper for the Snipp API.
Features
- Upload files from paths, bytes, or file objects
- Build albums and manage your posts
- Typed responses (
TypedDict) for editor completion - Simple error handling with
SnippError
Requirements
- Python 3.9 or higher
- A valid API key from the Snipp Console
Dependencies (automatically installed):
requests
Installation
pip install snipp
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()["user"]
# Upload a file
result = client.upload("screenshot.png", privacy="unlisted")
print(result["url"], result["post"]["url"])
# List your posts
posts = client.list_posts()["posts"]
# Delete a post
client.delete_post(result["post"]["code"])
API
Every method returns the parsed JSON response as a dict, typed with the TypedDict classes exported from snipp (User, Post, PostFile, PostList, and the rest).
SnippClient(api_key, region=None)
Create a client. The key is sent via the api-key header on every request.
| Argument | Type | Description |
|---|---|---|
api_key |
str |
Your Snipp API key. |
region |
str |
Optional. Pin requests to a regional endpoint, "eu-west-1" or "us-west-1". Uploads run at the same speed either way; this controls which region stores your files. Omit to use api.snipp.gg. |
client = SnippClient(api_key="YOUR_API_KEY", region="eu-west-1")
get_user(user_id="@me")
Fetch a user profile. Pass "@me" (default) for the authenticated user. api_key, key_has_uploads_access, upload_count, and limits are only present on yourself.
user = client.get_user("@me")["user"]
print(user["plan"], user["limits"]["usage"]["used_percent"])
get_user_posts(user_id, limit=None, cursor=None)
List a user's public posts, newest first. Team, private, unlisted, moderated, and restricted posts are never included. Pass "@me" for your own public posts. limit is 1-100 (default 30); cursor is the next_cursor from the previous page.
page = client.get_user_posts("987654321098765432", limit=10)
print(page["has_more"], page["next_cursor"])
list_posts(limit=None, cursor=None)
List your own posts of every privacy, newest first. Team posts are not included. Takes the same limit and cursor as get_user_posts. Follow next_cursor until it is None to walk every page:
cursor = None
while True:
page = client.list_posts(limit=100, cursor=cursor)
for post in page["posts"]:
print(post["code"], post["privacy"])
cursor = page["next_cursor"]
if cursor is None:
break
get_post(code)
Get a post by its share code. Team posts are only readable by members of that team, and have like_count and liked set to None.
post = client.get_post("AbC123")["post"]
print(post["url"], post["files"][0]["url"])
upload(file, privacy=None, title=None, description=None, post_type=None, include_metadata=None, priority=None)
Upload a file as a new post. file can be a path string, raw bytes, or an open file object. privacy must be "public", "unlisted", or "private"; it defaults to private when omitted. title caps at 30 chars, description at 200. post_type ("album" or "individual") is sent as the post-type header and has no effect through upload(), which sends a single file; use add_files to build an album. include_metadata=True keeps the file's metadata (EXIF, location, and the like), which the server strips when omitted. priority turns priority (adaptive) streaming for videos on or off; omitted, the server enables it when your plan is eligible. Returns url (the direct file URL) and post.
result = client.upload("image.png", privacy="unlisted")
print(result["url"], result["post"]["url"])
update_post(code, title=None, description=None, privacy=None)
Update a post's title, description, or privacy. Only the arguments you pass are changed; empty strings clear the title or description. A team post's privacy cannot be changed. Returns post.
client.update_post("AbC123", title="New title", privacy="public")
add_files(code, files, include_metadata=None, priority=None)
Add 1 or more files to an existing post, turning it into an album. Posts cap at 50 files total. New files inherit the post's privacy. include_metadata and priority work as on upload(). Returns post, plus failed when some files were rejected, each with its index and error.
result = client.add_files("AbC123", ["extra.png"], include_metadata=True)
print(result["post"]["file_count"], result.get("failed", []))
delete_file(code, name)
Delete one file from a post, by the name it has in post["files"]. Deleting a post's only file deletes the post.
post = client.get_post("AbC123")["post"]
client.delete_file("AbC123", post["files"][1]["name"])
delete_post(code)
Delete a post and every file in it.
client.delete_post("AbC123")
report_post(code, reason=None)
Report a post, with an optional reason (max 200 chars).
client.report_post("AbC123", "Spam")
report_user(user_id, reason=None)
Report a user, with an optional reason (max 200 chars).
client.report_user("987654321098765432", "Impersonation")
Error Handling
All API errors raise a SnippError with these attributes:
| Attribute | Type | Description |
|---|---|---|
status |
int |
HTTP status code. |
type |
str | None |
Error type, such as not_found, rate_limited, or quota_exceeded. None when the response did not carry one. |
message |
str |
Human-readable message, or the HTTP status text when the response did not carry one. |
body |
dict | None |
Parsed JSON response, or None when it was not JSON. Context fields live under body["error"], such as resets_at on quota_exceeded. |
from snipp import SnippClient, SnippError
try:
client.upload("image.png")
except SnippError as err:
if err.type == "quota_exceeded":
print(f"Weekly quota used up, resets at {err.body['error']['resets_at']}")
else:
raise
Migrating from 2.x
3.0 follows the reorganized Snipp API. Methods:
| 2.x | 3.0 |
|---|---|
list_uploads(limit) |
list_posts(limit, cursor), cursor-paginated posts |
edit_upload(code, ...) |
update_post(code, ...) |
append_upload(code, files) |
add_files(code, files) |
delete_upload(filename) |
delete_file(code, name), which now needs the post's share code |
get_user(user_id, include_posts, posts_limit) |
get_user(user_id) plus get_user_posts(user_id, limit, cursor) |
report_post(code, reason="") |
report_post(code, reason=None) |
New: delete_post(code), report_user(user_id, reason=None) |
Responses:
- Posts use one shape everywhere:
privacy(waspost_privacy),created_at(wascreated),view_count(wasviews),files[].name(wasfile_name), andfile_countreplacesis_album. The top-levelurls,file, andthumbnail_urlare gone; readfiles. upload()returnsurlandpost;message,file, andprocessing_timeare gone.- Users carry
plan(free,plus, orultra) in place ofplus,ultra, andbadges,created_atin place ofcreated, andblockingin place ofblocked_by_you.
Errors:
- The API now sends every error as an
errorobject withtype,message, and any context fields.SnippErrorgainstype,messagefalls back to the HTTP status text instead of the raw response body, and context fields moved from the top ofbodyintobody["error"]. A check likeerr.body.get("suspended")becomeserr.type == "suspended".
Contributing
We welcome suggestions and improvements:
- Open an issue
- Submit a pull request that adheres to our Terms of Service and Privacy Policy
License
MIT License © 2026 Snipp. See LICENSE for full details.
Metadata
Release files for snipp 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snipp-3.0.0.tar.gz | 12.6 kB | Without provenance | Details for snipp-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snipp-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for snipp-3.0.0-py3-none-any.whl |
Total release size: 23.9 kB
Release files / snipp-3.0.0.tar.gz
| Download URL | snipp-3.0.0.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f25ce5683fa799f4a33b57567047ed1900c3024b00ea6dccf8c04b171100bec
|
|
BLAKE2b-256 checksum How to use checksums |
75ad21a1d4004c59d6704df65d87f081369c3109b536f0db7065c266a828af70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / snipp-3.0.0-py3-none-any.whl
| Download URL | snipp-3.0.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ec180575d2004b3bfa99261104a9badb0f38b87000af9420e84be378d0c6a22
|
|
BLAKE2b-256 checksum How to use checksums |
1077b46595f81af84d4891624d6484f002d34bf46a1085bd59fbf16f1365f100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for snipp 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.