question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gkeepapi.APIException

See original GitHub issue

I am receiving the following APIException on multiple computers after being able to log in and use the API earlier today. I am able to successfully login using Google App passwords, but the error seems to occur during the initial sync.

Using Python 3.6.3 and gkeepapi-0.10.2:

import gkeepapi
keep = gkeepapi.Keep()
login_success = keep.login(my_username, my_app_password)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): android.clients.google.com
DEBUG:urllib3.connectionpool:https://android.clients.google.com:443 "POST /auth HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): android.clients.google.com
DEBUG:urllib3.connectionpool:https://android.clients.google.com:443 "POST /auth HTTP/1.1" 200 None
DEBUG:keep:Starting sync: None
DEBUG:keep:Syncing 0 labels and 0 nodes
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.googleapis.com
DEBUG:urllib3.connectionpool:https://www.googleapis.com:443 "POST /notes/v1/changes HTTP/1.1" 400 None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 347, in login
    self.sync()
  File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 543, in sync
    labels=[i.save() for i in self._labels.values()] if labels_updated else None,
  File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 249, in changes
    json=params
  File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 173, in send
    raise APIException(error['code'], error)
gkeepapi.APIException: {'errors': [{'domain': 'global', 'reason': 'invalid', 'message': 'Invalid Value'}], 'code': 400, 'message': 'Invalid Value'}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kiwizcommented, Mar 11, 2018

Thanks for the investigative work @aFrankLion @sentriz. I’ve pushed up a fix for the issue - let me know if it works for you.

1reaction
sentrizcommented, Mar 3, 2018

I’ve been trying to debug this. It looks like the request made here https://github.com/kiwiz/gkeepapi/blob/master/gkeepapi/__init__.py#L246 needs some more keys, this is the minimum shape I could get away with

{
    "clientTimestamp": "2018-03-03T19:06:34.761Z",
    "nodes": [],
    "requestHeader": {
        "clientVersion": {
            "major": "3",
            "minor": "2",
            "build": "9",
            "revision": "4"
        },
        "clientPlatform": "WEB",
        "capabilities": [
            {
                "type": "EC"
            },
            {
                "type": "TR"
            },
            {
                "type": "SH"
            },
            {
                "type": "LB"
            },
            {
                "type": "RB"
            },
            {
                "type": "DR"
            },
            {
                "type": "AN"
            },
            {
                "type": "PI"
            },
            {
                "type": "EX"
            },
            {
                "type": "SNB"
            },
            {
                "type": "CO"
            },
            {
                "type": "MI"
            },
            {
                "type": "NC"
            }
        ],
        "clientSessionId": "s--numbersnumbers-numbers"
    }
}

so removing any of clientPlatform, clientVersion, clientTimestamp, and clientLocale would give the 400 we’re talking about. (they are not currently there) I have no idea how do add the likes of clientSessionId though

Read more comments on GitHub >

github_iconTop Results From Across the Web

gkeepapi.exception.LoginException: ('BadAuthentication', None)
I tried to run this code , it gives me the error above. I tried with the Gmail login and password, then with...
Read more >
How to use the gkeepapi.exception function in gkeepapi | Snyk
To help you get started, we've selected a few gkeepapi.exception examples, based on popular ways it is used in public projects.
Read more >
gkeepapi 0.13.6 documentation
Raises: APIException – If the server returns an error. LoginException – If login() has not been called.
Read more >
Exception ApiException (2.20.1) - Java - Google Cloud
ApiException (String message, Throwable cause, StatusCode statusCode, boolean retryable) ... public class ApiException extends RuntimeException.
Read more >
gkeepapi - Bountysource
Thank you for maintaining this library. I am trying to use gkeepapi to export my notes from Bear Notes and upload them to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found