A Python wrapper for the Snoonotes API
Project description
PySnooNotes
Python wrapper for the Snoonotes API
Currently Supported Features:
- Fetch notes for a particular user
- Fetch Subreddit Notes - Caching implemented
- Add notes for a user
Not Supported Currently:
- Removing usernotes
Depends On:
requests==2.23.0
Usage:
Imports
To use in your python project, use:
from pysnoonotes.core import SnooNotes
Sample Usage
Authenticate using a Reddit account that can add usernotes and a user_key for that account that can be generated from "https://snoonotes.com/#!/userkey". The generated key is sent via PM to your reddit account.
sn = SnooNotes("username", "user_key")
- Returns a dictionary with usernames and their associated usernotes:
notes_for_username = sn.get_notes_for_user("username")
notes_for_usernames12 = sn.get_notes_for_user(["username1", "username2"])
- Returns notes supported in that particular subreddit:
subreddit_notes = sn.get_notes_for_subreddit("subreddit")
NOTE: This function caches queries using a pickle file to ./caches
directory to prevent repeated API requests. By default it automatically updates caches once a day. However, using use_cache=False
, you can manually trigger a call that bypasses cache (this call will also update the cache)
- Add a new usernote for the user under a subreddit with a custom note and a link to the comment/post:
sn.add_note_for_user("username", "note_type_id", "subreddit", "Reason for note", "www.reddit.com/r/subreddit/123abc/.../123abc")
The above is also summarized in the sample.py
script
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
Hashes for pysnoonotes-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2cd9a8e5dad5d1519562b641bc96db30ba550406fc1f47dc0a312467e83602d |
|
MD5 | 255d0f83261d9c0292eaad2ba6306add |
|
BLAKE2b-256 | b48c77cb1351c66ed4e05b22dc23b4e84ce4ba06f0be5aa325680b59d574a329 |