moistrockerr
Newbie
- Jun 15, 2021
- 8
- 0
whenever I make a request to send message it says "Looks like you've been doing that a lot. Take a break for 2 minutes before trying again." on field 'ratelimit'
This is my code below, where do you think I should put the proxy code and what should it be?
This is my code below, where do you think I should put the proxy code and what should it be?
import praw
import csv
reddit = praw.Reddit(
client_id="U_wkmnJaj_SmRA",
client_secret="secret",
user_agent="Python bot to message users (by /u/username)",
username="username",
password="password",
)
print(reddit.read_only)
lst=[]
for submission in reddit.subreddit("aww").new(limit=15):
author = (submission.author)
print("this is ",author)
print(type(author))
with open('usernames.csv', 'r') as fp:
s = fp.read()
if str(author) not in s:
lst.append(str(author)+',')
if lst:
with open('usernames.csv','a+') as fp:
fp.writelines(lst)
user_ids = []
with open('usernames.csv', 'r') as fp:
s = csv.reader(fp)
length = len(str(s))
for i in s:
user_ids.append(i)
for i in user_ids[0]:
try:
reddit.redditor(i).message("pls dont ban me", "im just making a bot for fun if u dont like me spamming just block me or something")
except praw.exceptions.APIException as err:
if err.error_type == "NOT_WHITELISTED_BY_USER_MESSAGE":
print("not whitelisted")
else:
raise # this re-propogates the error so whatever other error handling code you have can handle it