擅长:python、mysql、java
<p>我可以用下面的代码进行实验并使其工作,完全自动化。无需用户干预</p>
<pre><code>client_id = 1
client_secret = "XXXXXXXXX"
redirect_uri = "http://localhost:8080/testing"
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()
import requests
res = requests.post(login_url, allow_redirects = False, data = {
'username': 'xxxx@gmail.com',
'password': 'xxxxx'
})
auth_response = res.headers['Location']
# After logging in, the user will be redirected to a URL, auth_response.
session = auth.authenticate(auth_response)
print(session.files.list().items)
</code></pre>
<p>最后一行打印<code>[<mendeley.models.files.File object at 0x1115b5400>]</code>,这意味着如果工作的话访问</p>