【发布时间】:2018-05-26 09:56:17
【问题描述】:
我正在阅读来自 here 的 Mendeley 文档。我正在尝试在我的控制台中获取数据,我正在使用教程中的以下代码
from mendeley import Mendeley
# These values should match the ones supplied when registering your application.
mendeley = Mendeley(client_id, redirect_uri=redirect_uri)
auth = mendeley.start_implicit_grant_flow()
# The user needs to visit this URL, and log in to Mendeley.
login_url = auth.get_login_url()
# After logging in, the user will be redirected to a URL, auth_response.
session = auth.authenticate(auth_response)
现在我不明白最后一行代码中的auth_response 来自哪里?有人知道吗?谢谢
【问题讨论】:
-
这是一个断开连接的身份验证流程,需要手动干预。您需要打印
login_url,然后在您的浏览器中浏览它,这将给您一个auth_response。然后你在你的代码中使用它来进行身份验证。如果您需要有限的访问权限,您可以使用this -
我需要通过运行这样的脚本来自动更新我的文档,如果没有人工干预,这似乎是不可能的。我确实尝试过自动登录,但仍然无法正常工作。你对此有什么想法吗?
-
你可以使用 selenium 为你做这件事。您可以为 selenium 添加代码以打开浏览器、导航 url、填写登录详细信息然后为您获取代码
-
贴出答案,请看。这不需要任何硒或任何东西