Jappie Klooster e2023213fb Reddit poster (#1026) | 6 years ago | |
---|---|---|
.. | ||
.gitignore | 6 years ago | |
Readme.md | 6 years ago | |
__init__.py | 6 years ago | |
redditconf.py.example | 6 years ago |
You can use the 'subreddit' attribute in you articles to specify which subbreddit the article should be post in aside of your default sub.
We look for the subreddit in the metadata. Then try to find a post that has the same title as this article. If we can't find a post we create it.
I followed these steps for praw: https://praw.readthedocs.io/en/latest/getting_started/authentication.html#script-application Summeraized:
This will create an 'application', ie it let's reddit know you have a script by using the secret generated. Interesting from this screen is the secret and the app id. copy those over somewhere.
We need 4 pieces of information from you which you must not commit to source code. These should all be considered private. This script will expect these values to be set in the settings. You should store them for real in either an ignored file, environment variables, or pass them each time as command line options. Also make sure to set your SITEURL, for proper backlinks
https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html#praw.models.Subreddit.search https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html#praw.models.Subreddit.submit
REDDIT_POSTER_AUTH = {
'username': 'blah',
'password': 'pass',
'client_id': 'client',
'client_secret': 'secret',
'user_agent': 'python:pelican_redditposter:1 by /u/jappieofficial'
}
REDDIT_POSTER_COLLECT_SUB = "jappie"
On fedora the praw in yum is too old, however the pip requests doesn't work for some reason, so I installed praw with pip and requests with dnf which seems to work (requests probably needed some sys lib or something)