Skip to main content

Python API wrapper for Snipp

Project description

snipp

A Python wrapper for the Snipp API.

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()

# 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snipp-1.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snipp-1.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snipp-1.0.1.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

Hashes for snipp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d6b47c8431d1a6a136802a7a88fb6633df835d998695a33c794e21de7d7eb904
MD5 64a894dbc2aab52af5882218c0dac96e
BLAKE2b-256 71909f4b3fbf7d2b4714b17059c627b8b7935ca7078b6e582f55c11af7d99d6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snipp-1.0.1-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

Hashes for snipp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dfcd297774453b7f77a66d554cfc1a8fef7574e39f91be8b500df4231d05b432
MD5 b9bb5dc91a5a6aad9b645c5fd2df0f7f
BLAKE2b-256 c13c893894a2205059ec9beff2b111f49620d9791dc91c55be5aa680b0184fd2

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