我有一个 mendeley 帐户,我正在使用他们的在线版本。我创建了一个用户 ID 和客户端密码,将其保存在 config.yml 文件中并使用它进行身份验证。我正在使用他们网站上提供的以下代码
import yaml
from mendeley import Mendeley
with open('config.yml') as f:
config = yaml.load(f)
REDIRECT_URI = 'http://localhost:5000/oauth'
mendeley = Mendeley(config['clientId'], config['clientSecret'], REDIRECT_URI)
auth = mendeley.start_client_credentials_flow()
session = auth.authenticate()
这段代码工作正常,我没有错误。但是当我尝试使用示例中的命令访问数据时,它会引发错误。例如
>> print (session.profiles.me.display_name)
mendeley.exception.MendeleyApiException: The Mendeley API returned an error (status: 400, message: No userid found in auth token)
>> for document in session.documents.iter():
print document.title
mendeley.exception.MendeleyApiException: The Mendeley API returned an error (status: 403, message: Access to this document is not allowed)
我被困在这里,不知道如何从其 API 访问我在 mendeley 上的数据或文章。任何帮助将不胜感激。