import praw reddit = praw.Reddit( client_id="my client id", client_secret="my client secret", user_agent="my user agent", ) def get_posts(): ids = [] for submission in reddit.subreddit("news").new(limit=10): ids.append(submission.id) return ids