bullybear17
bullybear17

Reputation: 889

Trying to Scrape Reddit with praw.Reddit

Im trying to scrape Reddit with the praw.reddit command and I keep getting the following:

prawcore.exceptions.OAuthException: unauthorized_client error processing 
request (Only script apps may use password auth)

Heres the top of my code:(I removed the sensitive items)

import praw
import pandas as pd
import datetime as dt

reddit = praw.Reddit(client_id='zlpcoz08aNK8Bw', \
                 client_secret='', \
                 user_agent='comment_scraper 1.0 by /u/bullybear77777', 
\
                 username='', \
                 password='')

I think it's because of my user_agent ID? I looked online and found that this appears to be the structure but im not sure. Any helps here would be greatly appreciated

Upvotes: 2

Views: 2911

Answers (1)

b13rg
b13rg

Reputation: 490

This sort of error is caused by the type of app associated with that client id. Logging in with a password is restricted to script type apps.

When you create a new application, there are three types of apps to choose from:

  • web app: A web based application
  • installed app: An app intended for installation, such as on a mobile phone
  • script: Script for personal use. Will only have access to the developers accounts

If the application has the web app or installed app types then this form of authentication can't be used. You can't change the app type once it's created, but you can simply create a new one with a script type.

Upvotes: 7

Related Questions