Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests.exceptions.HTTPError when calling cv.collection.get_rows() #365

Open
felipehlvo opened this issue Feb 16, 2022 · 12 comments
Open

Comments

@felipehlvo
Copy link

I get an requests.exceptions.HTTPError after using cv.collection.get_rows()

The full error message is:
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\collection.py", line 239, in get_rows
return self.query(**kwargs)
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\collection.py", line 236, in query
return CollectionQuery(self, self._get_a_collection_view(), **kwargs).execute()
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\collection.py", line 411, in execute
**kwargs
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\client.py", line 294, in query_collection
return self._store.call_query_collection(*args, **kwargs)
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\store.py", line 350, in call_query_collection
response = self._client.post("queryCollection", data).json()
File "C:\Users\rober\Anaconda3\lib\site-packages\notion\client.py", line 262, in post
"message", "There was an error (400) submitting the request."
requests.exceptions.HTTPError: Something went wrong.

@ErwinGutierrez
Copy link

I have the same error from yesterday. Maybe the API V3 is down?

@ghost
Copy link

ghost commented Feb 16, 2022

This is a known issue, and the developer has not updated the application in a couple of years and I’m assuming it’s now dead. I don’t know of any forks from this project that have fixed the issue as folks are now using Notion’s own API.

Notion has its own API (https://developers.notion.com) that’s easy to get into; only disadvantage is that files cannot be uploaded.

@david-az
Copy link

It's because of a filter parameter that's not present anymore in the API.
For a quick fix, comment the "filter": filter in line 339 in store.py

"filter": filter,

@wsykala
Copy link
Contributor

wsykala commented Feb 16, 2022

Thanks @david-az!
If anyone is interested I have updated my fork of the repository with this change.

@ErwinGutierrez
Copy link

It's because of a filter parameter that's not present anymore in the API. For a quick fix, comment the "filter": filter in line 339 in store.py

"filter": filter,

Thank you David, its worked perfectly!

@srepollock
Copy link

srepollock commented Feb 17, 2022

@wsykala Thank you for the fix, while it did solve some issues I noticed we were still having some issues with the collections having the filter property and it failing. Here were our commits to fix:

https://github.com/WhitecapRSC/notion-py/tree/master

@todaysday
Copy link

@wsykala @srepollock could you please give a clue how to use collections without filter?
like i Have this in my code
query = workload_table.build_query(filter=filter_query)
But after this fixes I have
TypeError: init() got an unexpected keyword argument 'filter'

@poiuytrezaur
Copy link

filter field has been renamed to filters, and has a different syntax. removing the filter parameter for the request let you send requests, but disable any filter functionnality

@todaysday
Copy link

Do you know any patch to have filter functionality back?

@poiuytrezaur
Copy link

poiuytrezaur commented Feb 17, 2022 via email

@todaysday
Copy link

Thanks for the reply. Looks like the only way for my is to migrate to Official Beta API.

@srepollock
Copy link

@todaysday looks like the new format is updated here: https://developers.notion.com/reference/post-database-query-filter

// Example:
{
    "filter": {
        "and": [
            {
                "property": "Seen",
                "checkbox": {
                    "equals": false
                }
            },
            {
                "property": "Yearly visitor count",
                "number": {
                    "greater_than": 1000000
                }
            }
        ]
    }
}

I'm sure this could be coded in, but at this point it's an uneeded feature for the time being for our work. We use filters in our databases, just with the API we don't use the filters for now (we need all the data and filter once we have all that data separately).

I'm sure I'll update if/when we add this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants