I am using mendeley a lot for my research. I want to edit the "user-tags" for the documents in the catalog of my mendeley client. Specifically I want to add the reputation of the journal to this field (in form of h-factor or impact factor). I've successfully set up the OAuth2 Authentification and am able to retrieve all the documents in my catalog. However I am not able to change the details / sync them back.
Do you know if this would be possible with the Mendeley API?
I didn't find a method like set or sync in the documentation of the API.
from mendeley import Mendeley
# I've changed the authentication details of my script (of course)
client_id = ****
client_secret = "abcdefghijklmnop"
redirect_uri = "http://localhost:8080/someTest"
# 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()
res = requests.post(login_url, allow_redirects=False, data={
'username': 'mymail@myprovider.net',
'password': 'somePsasword?!'
})
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)
for document in session.documents.iter(view='tags'):
print(document.title)
a = session.documents.get("5982d0ce-0425-3548-a063-519620c17886", view='tags')
a.tags = "TESTETETSETEST"
Another option would be to just change my catalog locally on my PC, however I wasn't able to find a file / database for this in my mendeley directory
Edit:
I've tried the update() method mentioned in the API by changing the loop to the following. Which didn't solve my problem for now
for document in session.documents.iter(view='tags'):
print(document.tags)
document.tags = ["Test"]
document.update()