Skip to content

mmshivesh/PySnooNotes

Repository files navigation

PySnooNotes


Update August 28th 2021: The creator of SnooNotes has decided to deprecate Snoonotes. Although it (and this project will continue to work), there won't be any future updates. Read more here: https://www.reddit.com/r/ModSupport/comments/pboaei/due_to_recent_events_snoonotes_and_redditsharp/.

I will continue maintaining this project as and when different fork becomes popular.


PyPI PyPI license Python Version

Python wrapper for the Snoonotes API

Installation:

Pysnoonotes is available on PyPI. Just use the following command to get the latest build from PyPI:

pip3 install pysnoonotes

Supported Features:

  1. Fetch notes for a particular user
  2. Fetch Subreddit Notes - Caching implemented
  3. Add notes for a user
  4. Removing usernotes for a user

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")
  1. 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"])
  1. 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)

  1. 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")
  1. Delete a usernote for a given username, given a note_id.
sn.delete_note_for_user("username","note_id")

The above is also summarized in the sample.py script