Code Monkey home page Code Monkey logo

Comments (8)

gm1225 avatar gm1225 commented on May 27, 2024 1

I got it.
I just create a new integration and a new publication db. And it works...
Thanks for the comments!

from notion-scholar.

thomashirtz avatar thomashirtz commented on May 27, 2024

I just tried exactly what you did and it worked, maybe there is an issue with the page ID. Are you sure that you followed exactly the readme for the -db argument ? It could be the cause of the Bad Request error

The database_id is one part of the URL:
https://www.notion.so/<workspace_name>/<database_id>?v=<view_id>

For example, if the database url is :
https://www.notion.so/thomashirtz/be31bb3f190f46c69e804785cc83c7ce?v=5674957e71e24aeb91d6db65f7978f0c
The command that needs to be used to set the database is :
ns set-config -db be31bb3f190f46c69e804785cc83c7ce

Also the URL should be the database URL, and not one of the page that contains the view of the database

from notion-scholar.

gm1225 avatar gm1225 commented on May 27, 2024

I re-checked database_id and token also. But I couldn't find any mistake there.
So, I try to see what happen in client.py....

$ ns run -s "@misc{topping2022understanding,
      title={Understanding over-squashing and bottlenecks on graphs via curvature},
      author={Jake Topping and Francesco Di Giovanni and Benjamin Paul Chamberlain and Xiaowen Dong and Michael M. Bronstein},
      year={2022},
      eprint={2111.14522},
      archivePrefix={arXiv},
      primaryClass={stat.ML}
}"

And the results with my print statements are below. As you can see, when the path = databases/39dbc7419c5c43809fb67cfc45cfdb05/query , the response of request is [200 OK],
but after path changes into "pages", [400 bad request] occurs.

======Client======
== method:  POST
== path: databases/39dbc7419c5c43809fb67cfc45cfdb05/query
== query:  None
Build_request(~)
======BaseClient======
== method:  POST
== path:  databases/39dbc7419c5c43809fb67cfc45cfdb05/query
== query:  None
=======================
== request:  <Request('POST', 'https://api.notion.com/v1/databases/39dbc7419c5c43809fb67cfc45cfdb05/query')>
== response:  <Response [200 OK]>
== pase_response
==========================================
==========BaseClient_parse_response==========
== response:  <Response [200 OK]>
== after response.raise_for_status()
==========================================
1/1: Publication(key="topping2022understanding", title="Understanding over-squashing and bottlenecks on graphs via curvature")
======Client======
== method:  POST
== path: pages
== query:  None
Build_request(~)
======BaseClient======
== method:  POST
== path:  pages
== query:  None
=======================
== request:  <Request('POST', 'https://api.notion.com/v1/pages')>
== response:  <Response [400 Bad Request]>
== pase_response
==========================================
==========BaseClient_parse_response==========
== response:  <Response [400 Bad Request]>
Traceback (most recent call last):
  File "/home/hyeyun/anaconda3/lib/python3.8/site-packages/notion_client/client.py", line 127, 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

from notion-scholar.

thomashirtz avatar thomashirtz commented on May 27, 2024

Unfortunately I don't have enough information with that to fix the issue I believe.. Nothing points to my code for the error.
When I am trying to upload the entry that you put, it works on my side, I would need to be able to have a way to reproduce the error to be able to fix it :/

Quick note, to use the -s command, in general you need to use three quotes ``` and not only one

from notion-scholar.

jordanc17 avatar jordanc17 commented on May 27, 2024

I'm having the same issue - everything in my paperpile library except one paper works fine, so it's not a problem with my integration/database ID. This is the offending citation:

@ARTICLE{Weinstock2023-zw,
  title    = "Aberrant activation of {TCL1A} promotes stem cell expansion in
              clonal haematopoiesis",
  author   = "Weinstock, Joshua S and Gopakumar, Jayakrishnan and Burugula, Bala
              Bharathi and Uddin, Md Mesbah and Jahn, Nikolaus and Belk, Julia A
              and Bouzid, Hind and Daniel, Bence and Miao, Zhuang and Ly, Nghi
              and Mack, Taralynn M and Luna, Sofia E and Prothro, Katherine P
              and Mitchell, Shaneice R and Laurie, Cecelia A and Broome, Jai G
              and Taylor, Kent D and Guo, Xiuqing and Sinner, Moritz F and von
              Falkenhausen, Aenne S and Kääb, Stefan and Shuldiner, Alan R and
              O'Connell, Jeffrey R and Lewis, Joshua P and Boerwinkle, Eric and
              Barnes, Kathleen C and Chami, Nathalie and Kenny, Eimear E and
              Loos, Ruth J F and Fornage, Myriam and Hou, Lifang and
              Lloyd-Jones, Donald M and Redline, Susan and Cade, Brian E and
              Psaty, Bruce M and Bis, Joshua C and Brody, Jennifer A and
              Silverman, Edwin K and Yun, Jeong H and Qiao, Dandi and Palmer,
              Nicholette D and Freedman, Barry I and Bowden, Donald W and Cho,
              Michael H and DeMeo, Dawn L and Vasan, Ramachandran S and Yanek,
              Lisa R and Becker, Lewis C and Kardia, Sharon L R and Peyser,
              Patricia A and He, Jiang and Rienstra, Michiel and Van der Harst,
              Pim and Kaplan, Robert and Heckbert, Susan R and Smith, Nicholas L
              and Wiggins, Kerri L and Arnett, Donna K and Irvin, Marguerite R
              and Tiwari, Hemant and Cutler, Michael J and Knight, Stacey and
              Muhlestein, J Brent and Correa, Adolfo and Raffield, Laura M and
              Gao, Yan and de Andrade, Mariza and Rotter, Jerome I and Rich,
              Stephen S and Tracy, Russell P and Konkle, Barbara A and Johnsen,
              Jill M and Wheeler, Marsha M and Smith, J Gustav and Melander,
              Olle and Nilsson, Peter M and Custer, Brian S and Duggirala,
              Ravindranath and Curran, Joanne E and Blangero, John and McGarvey,
              Stephen and Williams, L Keoki and Xiao, Shujie and Yang, Mao and
              Gu, C Charles and Chen, Yii-Der Ida and Lee, Wen-Jane and Marcus,
              Gregory M and Kane, John P and Pullinger, Clive R and Shoemaker, M
              Benjamin and Darbar, Dawood and Roden, Dan M and Albert, Christine
              and Kooperberg, Charles and Zhou, Ying and Manson, Joann E and
              Desai, Pinkal and Johnson, Andrew D and Mathias, Rasika A and
              {NHLBI Trans-Omics for Precision Medicine (TOPMed) Consortium} and
              Blackwell, Thomas W and Abecasis, Goncalo R and Smith, Albert V
              and Kang, Hyun M and Satpathy, Ansuman T and Natarajan, Pradeep
              and Kitzman, Jacob O and Whitsel, Eric A and Reiner, Alexander P
              and Bick, Alexander G and Jaiswal, Siddhartha",
  journal  = "Nature",
  volume   =  616,
  number   =  7958,
  pages    = "755--763",
  month    =  apr,
  year     =  2023,
  language = "en"
}

and the error message:

 1/25: Publication(key="Weinstock2023-zw", title="Aberrant activation of {TCL1A} promotes stem cell expansion in
clonal haematopoiesis")
Traceback (most recent call last):
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_client/client.py", line 118, in _parse_response
    response.raise_for_status()
  File "<my_home>/envs/notion-scholar/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/pages'
For more information check: https://httpstatuses.com/400

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<my_home>/envs/notion-scholar/bin/ns", line 8, in <module>
    sys.exit(main())
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_scholar/main.py", line 143, in main
    return run(**config_manager.get_run_kwargs())
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_scholar/run.py", line 41, in run
    add_publications_to_database(
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_scholar/notion_api.py", line 59, in add_publications_to_database
    client.pages.create(
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_client/api_endpoints.py", line 199, in create
    return self.parent.request(
  File "<my_home>/envs/notion-scholar/lib/python3.9/site-packages/notion_client/client.py", line 194, in request
    return self._parse_response(response)
  File "<my_home>/envs/notion-scholar/lib/python3.9/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 `2679`.


@thomashirtz Truncating the author list to fit within the character limit fixes this error. I can open a PR if you think this would be a useful behavior to add

from notion-scholar.

thomashirtz avatar thomashirtz commented on May 27, 2024

If you are interested by doing it, go ahead :)
You can follow how I did for the abstract, or tell me if you think there is a better way to do it

abstract = publication.abstract

from notion-scholar.

jordanc17 avatar jordanc17 commented on May 27, 2024

I did it the way you did for the abstract, I'm not really sure if there's a better way to do it since the character limit is set in the Notion API.

from notion-scholar.

thomashirtz avatar thomashirtz commented on May 27, 2024

I did not see any way to circumvent that unfortunately

from notion-scholar.

Related Issues (7)

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.