gpt4 book ai didi

python - 引发 ClientException(required_message.format(属性)) praw.exceptions.ClientException : Required configuration setting 'client_id' missing

转载 作者:太空宇宙 更新时间:2023-11-04 00:46:07 30 4
gpt4 key购买 nike

我不确定如何进行这项工作。我也无法在我的应用程序中找到 client_id。我只看到那里的应用程序 secret :

>>> 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.

这是我的 praw.ini 文件,我不确定它是否正确或是否包含所有必需的字段:

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

非常感谢任何帮助。

**我也可以使用 praw 从 reddit 检索图像吗?或者你有什么建议?

最佳答案

该错误是由于 praw.ini 文件或 Python 脚本中缺少 client_id(这是您的唯一 API key 和 Reddit API 的 secret )引起的.

在你的脚本中你可以有这样的东西:

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

或按照以下链接中的说明在 praw.ini 文件中设置:

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

如果您已经注册访问 reddit API,它会说:

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

您可以从您的应用中获取您的 client_id: https://www.reddit.com/prefs/apps

enter image description here

在他们的文档(在 API 应用程序标题下)的这个示例中:client_id=p-jcoLKBynTLew

关于python - 引发 ClientException(required_message.format(属性)) praw.exceptions.ClientException : Required configuration setting 'client_id' missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39521621/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com