From 0171f45f031e4162deb3a0f2b94d9fdcf44f1d4a Mon Sep 17 00:00:00 2001 From: Shivesh Date: Sat, 18 Jul 2020 18:52:25 +0530 Subject: [PATCH] added readme and fix PEP8 Warnings --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ sample.py | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..10a75ea --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# PySnooNotes + +Python wrapper for the Snoonotes API + +## Currently Supported Features: + +1. Fetch notes for a particular user +2. Fetch Subreddit Notes - Caching implemented +3. Add notes for a user + +## Not Supported Currently + +1. Removing usernotes + +## Usage + +### Imports + +To use in your python project, use: + +`from SnooNotes.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")` + +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 diff --git a/sample.py b/sample.py index e9b9778..fd576d8 100644 --- a/sample.py +++ b/sample.py @@ -14,4 +14,4 @@ subreddit_notes = sn.get_notes_for_subreddit("subreddit") # Add a new usernote to the user under the subreddit with a note with a link to the comment/post. - sn.add_note_for_user("username","note_type", "subreddit","Reason for note", "www.reddit.com/r/subreddit/123jks/.../jkas12") + sn.add_note_for_user("username", "note_type", "subreddit", "Reason for note", "www.reddit.com/r/subreddit/123jks/.../jkas12")