This project allows you to export newly added or recently updated documents in Mendeley to your Notion database via the APIs provided by the two. If you'd like the export to happen as soon as you make a change in Mendeley, then you can run the script scripts/runMendToNotion.sh
peridocially at a reasonable frequency via a crontab
job.
.
+-- docs/
| +-- images/
| | +-- demo.png
| | +-- icon.png
+-- globalStore/
| +-- constants.py
+-- lib/
| +-- port_utils.py
| +-- utils.py
+-- mendeley/
| +-- auth.py
| +-- session.py
| +-- ...
+-- notebooks/
| +-- trial.py
+-- scripts/
| +-- runMendToNotion.sh
+-- secrets/
| +-- secrets_mendeley.json
| +-- secrets_notion.json
+-- src/
| +-- mendeleyToNotion.py
+-- .gitignore
+-- environment.yml
+-- juyptext.toml
+-- README.md
+-- requirements.txt
+-- STDOUTlog_examples.txt
This hasn't been tested out after Mendeley's Sept 1, 2022 changes. It is not clear how long the API will remain available for easy access to Mendeley data.
clientID
, clientSecret
and redirectURL
and add it to secrets/secrets_mendeley.json
in the following format:
{
"clientId": "your client ID",
"clientSecret": "your client secret",
"redirectURL": "your client redirect URL"
}
notionToken
getPropertiesForMendeleyDoc
and getNotionPageEntryFromPropObj
in lib/port_utils.py
.
Title property: Citation
Text properties: TItle, UID, Authors, Venue, Year, Abstract, Type, BibTex, Filename, ARXIV, DOI, ISSN, ISBN, PMID
Url properties: Filepath
Date properties: Created At, Last Modified At
databaseID
and add it to secrets/secrets_notion.json
in the following format:
{
"notionToken": "your notion token",
"databaseID": "your notion database ID"
}
src/mendeleyToNotion.py
with --secretsFilePath
argument as secrets/secrets_mendeley.py
.secrets/secrets_mendeley.py
.scripts/runMendToNotion.sh
using a crontab job to get periodic updates. For more information on Crontab, check out this reference.You can install all the requirements using the following command:
pip install -r requirements.txt
pip install -e .
Note: I wanted to make use of the mendeley python sdk directly, but their auth
code has issues with the refresh
method. Instead, I have cloned the mendeley
project and made changes to it locally, most notably in the MendeleyAuthorizationCodeTokenRefresher
class in mendeley/auth.py
def refresh(self, session):
#oauth = OAuth2Session(client=self.client, redirect_uri=self.redirect_uri, scope=['all'], token=session.token)
#print(session.token)
#oauth.compliance_hook['access_token_response'] = [handle_text_response]
#session.token = oauth.refresh_token(self.token_url, auth=self.auth)
session.refresh_token(self.token_url, auth=self.auth)
#print(session.token)
@misc{nanbhas2021_mendeleyToNotion,
title={Mendeley To Notion},
author={Nandita Bhaskhar},
howpublished={GitHub Repo, https://github.com/nanbhas/MendeleyToNotion},
year={2021}
}