Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.snipp.gg/llms.txt

Use this file to discover all available pages before exploring further.

snipp-gg/snipp

snipp

Installation

pip install snipp
Requires Python 3.9 or later. Depends on requests.

Getting Started

from snipp import SnippClient

client = SnippClient(api_key="YOUR_API_KEY")

me = client.get_user("@me")
print(me["user"]["username"])

Methods

get_user(user_id, include_posts=None, posts_limit=None)

Fetch a user by ID. Pass "@me" for the authenticated user.
ParameterTypeDescription
user_idstrUser ID or "@me".
include_postsbool | NoneInclude the user’s public uploads.
posts_limitint | NoneNumber of posts to return (1 to 50).
user = client.get_user("@me", include_posts=True, posts_limit=10)

get_post(code)

Fetch a post by its share code.
ParameterTypeDescription
codestrThe share code of the post.
post = client.get_post("AbCd1234")
print(post["post"]["url"])

upload(file, privacy="unlisted", title=None, description=None, post_type=None)

Upload a file. Accepts a file path string, bytes, or a file-like object.
ParameterTypeDescription
filestr | bytes | BinaryIOFile path, raw bytes, or file object.
privacystr"public", "unlisted", or "private".
titlestr | NoneOptional post title (max 30 chars).
descriptionstr | NoneOptional post description (max 200 chars).
post_typestr | None"album" (default) or "individual". Only applies when uploading two or more files.
result = client.upload("image.png", privacy="unlisted", title="My screenshot")
print(result["url"])

list_uploads(limit=None)

List the authenticated user’s recent uploads. Defaults to 30. Pass limit to control the count (max 1000).
ArgumentTypeDescription
limitint | NoneMaximum uploads to return (1-1000).
uploads = client.list_uploads(limit=100)

edit_upload(code, title=None, description=None, privacy=None)

Edit an existing upload’s title, description, or privacy.
ParameterTypeDescription
codestrThe share code of the upload.
titlestr | NoneNew title (max 30 chars). Empty string to clear.
descriptionstr | NoneNew description (max 200 chars). Empty string to clear.
privacystr | None"public", "unlisted", or "private".
client.edit_upload("AbCd1234", title="New title", privacy="public")

append_upload(code, files)

Add one or more files to an existing album post. The post’s share code, privacy, title, and description are preserved. Albums cap at 9 files total. Requests that would exceed the cap are rejected. New files inherit the post’s privacy. Returned URLs are signed with a 24-hour expiry for private posts.
ParameterTypeDescription
codestrShare code of the post to append to.
fileslist[str | bytes | BinaryIO]One or more files. Each item may be a file path, raw bytes, or a file-like object.
result = client.append_upload("AbCd1234", ["photo-a.png", "photo-b.png"])
print(result["post"]["fileCount"])

delete_upload(filename)

Delete an upload by its filename. On albums, only that file is removed; on single-file posts the entire post is deleted.
client.delete_upload("a3f7b2c91d4e8f0612ab34cd56ef7890.png")

Error Handling

All API errors raise a SnippError with status and message attributes.
from snipp import SnippClient, SnippError

try:
    client.get_user("nonexistent")
except SnippError as err:
    print(err.status, err.message)