thomashirtz / notion-scholar Goto Github PK
View Code? Open in Web Editor NEWReference management solution using Python and Notion.
License: Apache License 2.0
Reference management solution using Python and Notion.
License: Apache License 2.0
First of all, thanks so much for creating this amazing tool! This is exactly what I was looking for to easily manage all my references when writing my masters thesis, but unfortunately I can't get it to work.
I have went over the installation procedure several times, and think I am doing everything correctly.
I have installed the ns package with pip, created the integration, set the token, database and bib-file, but when running ns run
, I get an 'notion_client.errors.APIResponseError: Invalid request URL.'
The connection to ns-scholar is in the Publication DB (I copied the template), and the database-id is set to the URL of this page.
Am I doing something wrong, or are there any solutions to this?
I am doing this on an M2 Mac, from the default zsh terminal. My Notion account is also accessed through my University email, as this grants me a free Education Plus Plan.
Here is the output I get in the terminal, I have also ran ns inspect-config
first if the information should be useful:
erlendkopperud@eduroam-193-157-176-218 ~ % ns inspect-config
config_file_path: /Users/erlendkopperud/Library/Application Support/notion-scholar/config.ini
config_file_exist: True
token: secret_NIA0cY0UAJzxnt5rK1WeNJ4mMhK5FCAOEXpeflefq6A
database_id: https://www.notion.so/erlendkopp/199bf7f29eb64de3b439ec2796584249?v=ac9d18439dbd4b97ad0d9a38316f9a6b
file_path: /Users/erlendkopperud/Documents/Master/refs.bib
erlendkopperud@eduroam-193-157-176-218 ~ %
erlendkopperud@eduroam-193-157-176-218 ~ % ns run
Traceback (most recent call last):
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/httpx/_models.py", line 749, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.notion.com/v1/databases/https://www.notion.so/erlendkopp/199bf7f29eb64de3b439ec2796584249?v=ac9d18439dbd4b97ad0d9a38316f9a6b/query'
For more information check: https://httpstatuses.com/400
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/bin/ns", line 8, in <module>
sys.exit(main())
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_scholar/main.py", line 143, in main
return run(**config_manager.get_run_kwargs())
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_scholar/run.py", line 35, in run
key_list = get_publication_key_list_from_database(
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_scholar/notion_api.py", line 104, in get_publication_key_list_from_database
return get_property_list_from_database(
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_scholar/notion_api.py", line 74, in get_property_list_from_database
query = notion.databases.query(
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_client/api_endpoints.py", line 132, in query
return self.parent.request(
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_client/client.py", line 194, in request
return self._parse_response(response)
File "/Users/erlendkopperud/.pyenv/versions/3.9.16/lib/python3.9/site-packages/notion_client/client.py", line 126, in _parse_response
raise APIResponseError(response, body["message"], code)
notion_client.errors.APIResponseError: Invalid request URL.
It seems that Notion's API restricts us to 2000 characters max. For example, trying to push an entry with a long abstract produces the error:
notion_client.errors.APIResponseError: body failed validation: body.properties.Bibtex.rich_text[0].text.content.length should be ≤
2000, instead was
2123.
What are your thoughts on automatically truncating long strings? I've been running a preprocessing script before each notion-scholar run to do this, but figure it might be useful as a built-in feature for others.
This is a cool library -- it's always nice when you are looking for a functionality and it turns out someone has already implemented it. So first of all, thanks!
A quick note on usability of installation. The tl;dr is that after following the installation instructions, the Publication and Categories links still point to your Notion; I suggest adding a step in the tutorial explaining how to create new databases and link to them. In some more detail:
Steps to reproduce
Expected outcome
Actual outcome
Analysis and possible solution
Hello.
I tried
$ pip uninstall notion-scholar
$ pip uninstall -r requirement.txt
$ pip install git+https://github.com/thomashirtz/notion-scholar#egg=notion-scholar
And I also refresh the token and reset the config.
But still I have the same problem below:
$ ns run -f NIPS-2017-attention-is-all-you-need-Bibtex.bib
Traceback (most recent call last):
File "/home/hyeyun/anaconda3/lib/python3.8/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/home/hyeyun/anaconda3/lib/python3.8/site-packages/httpx/_models.py", line 749, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.notion.com/v1/pages'
For more information check: https://httpstatuses.com/400
During handling of the above exception, another exception occurred:
...
Thank you.
Hi! I'm not sure what exactly I am doing wrong, but it seems like it isn't porting in the link for my Notion database URL. Any help would be appreciated! It also seems like the truncation issue that was talked about in a previous post is popping up here as well. Maybe it will still work if I fix the first issue, but just thought I should ask.
1/23: Publication(key="10.1039/c5ra11101c", title="{A review on natural surfactants}")
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_models.py", line 749, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.notion.com/v1/pages'
For more information check: https://httpstatuses.com/400
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/ns", line 33, in <module>
sys.exit(load_entry_point('notion-scholar==0.2.0', 'console_scripts', 'ns')())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_scholar/main.py", line 143, in main
return run(**config_manager.get_run_kwargs())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_scholar/run.py", line 41, in run
add_publications_to_database(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_scholar/notion_api.py", line 59, in add_publications_to_database
client.pages.create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_client/api_endpoints.py", line 199, in create
return self.parent.request(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_client/client.py", line 194, in request
return self._parse_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/notion_client/client.py", line 126, in _parse_response
raise APIResponseError(response, body["message"], code)
notion_client.errors.APIResponseError: body failed validation: body.properties.Bibtex.rich_text[0].text.content.length should be ≤ `2000`, instead was `2071`.
Thank you for providing this useful Python package!
The bib-string
command line option "-s" does not work as described in the README. It requires you to additionally also pass a bibliography file via "-f". I will provide a fix in a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.