2

I am not sure how to make this work. I also can't find client_id in my app. I just see the app secret there:

>>> import praw
>>> r = praw.Reddit(user_agent='custom data mining framework',
... site_name='lamiastella')
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/local/lib/python2.7/dist-packages/praw/reddit.py", line 101, in __init__
    raise ClientException(required_message.format(attribute))
praw.exceptions.ClientException: Required configuration setting 'client_id' missing. 
This setting can be provided in a praw.ini file, as a keyword argument to the `Reddit` class constructor, or as an environment variable.

here is my praw.ini file which I am not sure if it's correct or has all the necessary fields:

[lamiastella]
domain: www.monajalal.com
user: lamiastella
pswd: mypassword

any help is really appreciated.

**Can I retrieve images using praw as well from reddit or what do you suggest?

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408

1 Answers1

3

The error is caused from a missing client_id (which is your unique API key and secret for the Reddit API) in your praw.ini file or in your Python script.

In your script you could have something like:

r.set_oauth_app_info(client_id='stJlUSUbPQe5lQ',
...                      client_secret='DoNotSHAREWithANYBODY',
...                      redirect_uri='http://127.0.0.1:65010/'
...                                   'authorize_callback')

https://praw.readthedocs.io/en/stable/pages/oauth.html?highlight=client_id#step-2-setting-up-praw

Or set up in the praw.ini file as described in the link below:

https://praw.readthedocs.io/en/stable/pages/configuration_files.html#configuration-variables

If you have already signed up for access to the reddit API, it says:

https://www.reddit.com/wiki/api

OAUTH Client ID(s) *

  • if you don't have yet, please email api@reddit.com when received or when you add additional

You can get your client_id from your app in: https://www.reddit.com/prefs/apps

enter image description here

In this example from their documentation (under the API app title): the client_id=p-jcoLKBynTLew

Community
  • 1
  • 1
ode2k
  • 2,653
  • 13
  • 20
  • My r is not set hence I can not use it. I have error in `r = praw.Reddit(user_agent='custom data mining framework', ... site_name='lamiastella')` where r is assigned! I was asking this question to see where I can find client_id exactly and how to set up praw.ini – Mona Jalal Sep 16 '16 at 16:07
  • 1
    Updated where you can find the `client_id` – ode2k Sep 16 '16 at 16:23
  • Thank you so much for the screenshot. It made it clear to me where the client_id is :) – Mona Jalal Sep 16 '16 at 17:08
  • This answer pertains to PRAW<4. The error message in the question belongs to PRAW4, which does not have a `set_oauth_app_info` as these values are passed directly to the `Reddit` class initializer. – bboe Sep 19 '16 at 06:09
  • @ode2k seems you are familiar with praw. can you please have a look at this http://stackoverflow.com/questions/39578098/headers-authorization-bearer-accesstokenaccess-token-user-agent ? thanks – Mona Jalal Sep 19 '16 at 16:46