Demo & Practice: Author Info
Contents
6.2.2. Demo & Practice: Author Info#
Though Reddit collects the device/program sources of submissions (like we saw from former President Trump), it unfortunately doesn’t let us see them.
Instead we will look at other information about the author of posts on Reddit that can perhaps tell us something about their authenticity.
Log into Reddit (PRAW)#
These are our normal steps get PRAW loaded and logged into Reddit
import praw
(optional) make a fake praw connection with the fake_praw library
For testing purposes, we’ve added this line of code, which loads a fake version of praw, so it wont actually connect to reddit. If you want to try to actually connect to reddit, don’t run this line of code.
%run ../../fake_apis/fake_praw.ipynb
Fake praw is replacing the praw library. Fake praw doesn't need real passwords, and prevents you from accessing real reddit
# Load all your developer access passwords into Python
# TODO: Put your reddit username, password, and special developer access passwords below:
username="fake_reddit_username"
password="sa@#4*fdf_fake_password_$%DSG#%DG"
client_id="45adf$TW_fake_client_id_JESdsg1O"
client_secret="56sd_fake_client_secret_%Yh%"
# Give the praw code your reddit account info so
# it can perform reddit actions
reddit = praw.Reddit(
username=username, password=password,
client_id=client_id, client_secret=client_secret,
user_agent="a custom python script"
)
Fake praw is pretending to collect account info to use on reddit