オンライン版から使用している 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 にあるデータや記事にアクセスする方法がわかりません。どんな助けでも大歓迎です。