Code Monkey home page Code Monkey logo

notion-scholar's People

Contributors

georg-wolflein avatar jordanc17 avatar thomashirtz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

notion-scholar's Issues

Invalid request URL

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.

Feature request: automatically truncate strings that exceed 2000 characters

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.

After following installation guide, DB links still point to thomashirtz.notion.so

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

  • Follow the installation guide, and specifically duplicate the page template as linked therein.

Expected outcome

  • Everything works correctly.

Actual outcome

  • All the views (Publication DB and Categories DB) link to [thomashirtz.notion.so].

Analysis and possible solution

  • Duplicating the template does not modify the links inside the template. It would be cool if there was a recursive "duplicate" functionality in Notion, but I'm not sure that exists. Instead, one could simply add a step a final step to the installation guide directing the user how to create their own Publication DB and Categories DB (e.g., by duplicating the respective pages in thomashirtz.notion.site ...).

HTTPStatusError

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.

400 Bad Request error when loading in a BibTex file

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`.


The "-s" option is not working

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.