I'm not very good with API and async whatnot but this piece of code is literally taken right from the asyncpraw documentation, yet it's producing an error. I'd appreciate it if anyone can help.
import asyncpraw
reddit = asyncpraw.Reddit(
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
user_agent="USER_AGENT",
)
print(reddit.read_only)
subreddit = await reddit.subreddit("ProgrammerHumor")
async for submission in subreddit.hot(limit=10):
print(submission.title)
It's supposed to print the top ten posts on reddit from r/programmerhumor
Edit:
I changed line 10 to this:
async def getSubreddit():
return await reddit.subreddit("ProgrammerHumor")
subreddit = getSubreddit()
Got this