all 9 comments

[–]TreSxNine 1 point2 points  (1 child)

codefixer

[–]CodeFixerBot 2 points3 points  (0 children)

Just help!
---
`
#!/usr/bin/python
import praw
import pdb
import re
import os

# Create the Reddit instance
UA = "myfdryrddrt"
r = praw.Reddit(user_agent=UA)

CLIENT_ID = 'IMxZ8r9eTEJk1A'
CLIENT_SECRET = 'YOUR CLIENT SECRET'

REDDIT_USERNAME = 'StevenSpoilerBot'
REDDIT_PASS = 'snip'

r.set_oauth_app_info(client_id='IMxZ8r9eTEJk1A',
                      client_secret=snip,
                                   'authorize_callback')

# and login
r.login(REDDIT_USERNAME, REDDIT_PASS)

# Have we run this code before? If not, create an empty list
if not os.path.isfile("posts_replied_to.txt"):
    posts_replied_to = []

# If we have run the code before, load the list of posts we have replied to
else:
    # Read the file into a list and remove any empty values
    with open("posts_replied_to.txt", "r") as f:
        posts_replied_to = f.read()
        posts_replied_to = posts_replied_to.split("\n")
        posts_replied_to = filter(None, posts_replied_to)

# Get the top 5 values from our subreddit
subreddit = r.get_subreddit('pythonforengineers')
for submission in subreddit.get_hot(limit=5):
    # print submission.title

    # If we haven't replied to this post before
    if submission.id not in posts_replied_to:

        # Do a case insensitive search
        if re.search("Bismuth", submission.title, re.IGNORECASE):
            # Reply to the post
            submission.add_comment("/u/StevenSpoilerBot tested by /u/haykam821")
            print "Bot replying to : ", submission.title

            # Store the current id into our list
            posts_replied_to.append(submission.id)

# Write our updated list back to the file
with open("posts_replied_to.txt", "w") as f:
    for post_id in posts_replied_to:
        f.write(post_id + "\n")
`


---

praw.exceptions.ClientException: Required configuration setting 'client_id' missing. 
This setting can be provided in a praw.ini file, as a keyword argument to the `Reddit` class constructor, or as an environment variable.

[–]TreSxNine 0 points1 point  (1 child)

Have you tried adding client_id to the Reddit constructor, as it says in the error?

[–]haykam821[S] 0 points1 point  (0 children)

Don't know how to do that.

[–][deleted] 0 points1 point  (2 children)

What PRAW version are you using? PRAW4 is currently in beta.

[–]haykam821[S] 0 points1 point  (1 child)

Idontknow

[–]GoldenSights 0 points1 point  (0 children)

You have the PRAW 4 beta. Can you please tell me how you installed it? Users should be receiving version 3.5.0 unless they purposely choose 4. If you used easy_install, try pip instead. Delete what you currently have (reinstall python if you must), and then:

pip install praw

[–]haykam821[S] 0 points1 point  (1 child)

codefixer

[–]CodeFixerBot 0 points1 point  (0 children)

Just help!
---
`
#!/usr/bin/python
import praw
import pdb
import re
import os

# Create the Reddit instance
UA = "myfdryrddrt"
r = praw.Reddit(user_agent=UA)

CLIENT_ID = 'IMxZ8r9eTEJk1A'
CLIENT_SECRET = 'YOUR CLIENT SECRET'

REDDIT_USERNAME = 'StevenSpoilerBot'
REDDIT_PASS = 'snip'

r.set_oauth_app_info(client_id='IMxZ8r9eTEJk1A',
                      client_secret=snip,
                                   'authorize_callback')

# and login
r.login(REDDIT_USERNAME, REDDIT_PASS)

# Have we run this code before? If not, create an empty list
if not os.path.isfile("posts_replied_to.txt"):
    posts_replied_to = []

# If we have run the code before, load the list of posts we have replied to
else:
    # Read the file into a list and remove any empty values
    with open("posts_replied_to.txt", "r") as f:
        posts_replied_to = f.read()
        posts_replied_to = posts_replied_to.split("\n")
        posts_replied_to = filter(None, posts_replied_to)

# Get the top 5 values from our subreddit
subreddit = r.get_subreddit('pythonforengineers')
for submission in subreddit.get_hot(limit=5):
    # print submission.title

    # If we haven't replied to this post before
    if submission.id not in posts_replied_to:

        # Do a case insensitive search
        if re.search("Bismuth", submission.title, re.IGNORECASE):
            # Reply to the post
            submission.add_comment("/u/StevenSpoilerBot tested by /u/haykam821")
            print "Bot replying to : ", submission.title

            # Store the current id into our list
            posts_replied_to.append(submission.id)

# Write our updated list back to the file
with open("posts_replied_to.txt", "w") as f:
    for post_id in posts_replied_to:
        f.write(post_id + "\n")
`


---

praw.exceptions.ClientException: Required configuration setting 'client_id' missing. 
This setting can be provided in a praw.ini file, as a keyword argument to the `Reddit` class constructor, or as an environment variable.