[Python] How to fix 403 in asyncpraw. I get it every time after 1.5 days after creating an app...

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    i have a problem with praw or reddit api.

    when i create new app in reddit api it works beautiful, without any errors with my web app.

    But after 1.5 days it stops working and returns only 403. i do not know what to do. My user agent is :

    REDDIT_USER_AGENT = "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36:redditVsx:v1.0 (by /u/Traditional-Key2823)"

    i have tried RedditVsx as in my reddit api app and redditvsx also (name of app is not the same, but it looks the same)

    reddit = asyncpraw.Reddit(
    client_id=settings.REDDIT_CLIENT_ID,
    client_secret=settings.REDDIT_CLIENT_SECRET,
    user_agent=settings.REDDIT_USER_AGENT,
    )

    async def get_subreddit_rules(subreddit_name: str):
    try:
    subreddit = await reddit.subreddit(subreddit_name)
    subreddit_rules = []

    async for rule in subreddit.rules:
    subreddit_rules.append(rule)

    return subreddit_rules
    except Exception as e:
    logging.error(e)
    return [];



    i have tried different user agent from short to long, i have recreated apps more than 10 times, i used different accounts. I use only script apps because of asyncpraw (may be that is somehow can not work with my web app)

    Continue reading...

Compartilhe esta Página