Skip to content
xCROvPublic
forked from danthedaniel/puni

About

Python UserNotes Interface for reddit

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

78 Commits

Folders and files

Repository files navigation

PUNI

PyPI version Coverage Status Build Status Code Health

Python UserNotes Interface for Reddit.

Built to interact with the user notes data store from the reddit moderator toolbox (spec here).

Requirements:

  • PRAW (Supports PRAW 7.1.0)
  • Python 2.7, or 3.X

Note: PUNI only supports usernotes of schema version 6.

Usage:

Full documentation.

Creating a usernotes object

import praw
import puni

r = praw.Reddit(...)
sub = r.subreddit('subreddit')
un = puni.UserNotes(r, sub)

Adding a note

# Create given note with time set to current time
link = 'http://www.reddit.com/message/messages/4vjx3v'
n = puni.Note(user='username', note='note', mod='moderator', link=link, warning='permban')
un.add_note(n)

The list of warning types (like 'permban' as shown above), can be accessed from puni.Note.warnings.

Reading a user's notes

for note in un.get_notes('username'):
    print(note.note)

Pruning shadowbanned and deleted users

import puni
import praw

r = praw.Reddit(...)

sub = r.subreddit('my_subreddit')
un = puni.UserNotes(r, sub)

for user in un.get_users():
    try:
        u = r.redditor(user).fullname
    except:
        print("{} is shadowbanned/deleted".format(user))
        # To prevent unnecessary API requests, you need to specify remove_user
        # as lazy.
        un.remove_user(user, lazy=True)

# Now update the usernotes
un.set_json("Pruned users via puni")

About

Python UserNotes Interface for reddit

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages