我有一个mendeley帐户,我在他们的在线版本中使用。我创建了一个用户ID和客户端密钥,将其保存在config.yml文件中并使用它进行身份验证。我使用their website
上提供的以下代码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()
此代码工作正常,我没有错误。但是当我尝试使用example中的命令访问数据时,它会抛出错误。例如
>> 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)
我被困在这里,不知道如何访问我在mendeley上的数据或文章的API。任何帮助将受到高度赞赏。