TypeError: 'NoteType' object is not subscriptable when authenticating with 2FA (v3.0.11)
See original GitHub issueTrying to get the new (v3.0.11) version working, to create a cookie. I run:
username='redacted@gmail.com'
password='********'
cookiesfile="MY_COOKIES.email@gmail.com"
from locationsharinglib import CookieGetter
cg = CookieGetter(username, password, cookies_file=cookiesfile)
I get the result:
Traceback (most recent call last):
File "test-get-cookies.py", line 7, in <module>
cg = CookieGetter(username, password, cookies_file=cookiesfile)
File "/home/jpl/.virtualenvs/locationsharinglib/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 359, in __init__
cookies_file=cookies_file)
File "/home/jpl/.virtualenvs/locationsharinglib/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 225, in __init__
self._authenticate()
File "/home/jpl/.virtualenvs/locationsharinglib/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 263, in _authenticate
self._submit_password()
File "/home/jpl/.virtualenvs/locationsharinglib/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 310, in _submit_password
self._handle_prompt(body)
File "/home/jpl/.virtualenvs/locationsharinglib/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 318, in _handle_prompt
data_key = data[0][10][0][0][23]['5004'][12]
TypeError: 'NoneType' object is not subscriptable
If I hack _handle_prompt() to print out the value of “data” immediately after json decoding, it shows “None” in all of the arrays in the list.
This is what it looks like:
[['gf.sicr', None, None, 3, None, None, None, None, None, None, [[[None, None, 'TWO_STEP_VERIFICATION', 5, None, None, None, None, 4, None, 1, 1, 1, None, None, 'Firstname Lastname', 'redacted@gmail.com', 'https://lh3.googleusercontent.com/-cpXahc_wJtY/AAAAAAAAAAI/AAAAAAAAAAA/randomrandomrandom/mo/photo.jpg', None, None, None, None, [], None, 8, {'1004': [None, None, None, 'myaccount.google.com/webapproval', 1, [], [], []]}], [None, None, 'TWO_STEP_VERIFICATION', 4, None, None, None, None, 5, None, 1, 1, 1, None, None, 'Firstname Lastname', 'redacted@gmail.com', 'https://lh3.googleusercontent.com/-cpXahc_wJtY/AAAAAAAAAAI/AAAAAAAAAAA/randomrandomrandom/mo/photo.jpg', None, None, None, None, [], None, 8, {'1005': [[], [], None, 0]}], [None, None, 'TWO_STEP_VERIFICATION', 2, None, None, None, None, 6, None, 1, 1, 1, None, None, 'Firstname Lastname', 'redacted@gmail.com', 'https://lh3.googleusercontent.com/-cpXahc_wJtY/AAAAAAAAAAI/AAAAAAAAAAA/randomrandomrandom/mo/photo.jpg', None, None, None, None, [], {'1006': ['ANDROID']}], [None, None, 'TWO_STEP_VERIFICATION', 3, None, None, None, None, 9, None, 1, 1, 1, None, None, 'Firstname Lastname', 'redacted@gmail.com', 'https://lh3.googleusercontent.com/-cpXahc_wJtY/AAAAAAAAAAI/AAAAAAAAAAA/randomrandomrandom/mo/photo.jpg', None, None, None, None, [], {'1009': [' 48', 'SMS', ['SMS'], None, 'TWO_STEP_PREFERRED']}]], 1, 2, 2, None, 2, 1, None, [[8], None, None, None, 1], [None, None, None, None, 0]]], ['gf.ttu', 0, 'AHnYQLzhB-RandomRandomRandomRandom-ZbMEtKj8uWOkHKRNy-oG3WW3hU4FG2yRGmRJpyS0bnpNk7JNiMSsLAd2L1NThalG2e4TIrDGBHCVfkF7nCk_wOBFftTpP_DCkd-wuiQ-mBx0FBindfMVYT0oRcmWuU']]
I know that the first factor is working, because if I put in a bogus password, I get a different response (locationsharinglib.locationsharinglibexceptions.InvalidCredentials). I don’t get any second factor prompt on my phone.
The “Usage” doco doesn’t provide enough detail for me to follow, I’m afraid. And I’m not sure whether I’m doing it wrong, or if there’s a change to the Google API that’s breaking the lib. I’d be grateful for help in getting this working.
I assume step 1 is to create a valid cookie file, and then step 2 is to use this to get some real work done.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (7 by maintainers)
Hi @jezzaaa apologies for the late reply. If things do not work for you in the current release, it means that you are using yet another auth mechanism of Google. Chasing that thing around is not working great but I thought that @lufton 's patch worked for everybody so I parked my investment on making another process to get the cookies interactively. It seems that I have to rekindle that effort… Sadly I am extremely busy for this to move fast. I can provide some demo code soon enough for some people to move forward but nothing really robust or finished.
Hi all, I have created an alpha of a cookiegetter project that drives a browser through selenium and saves the cookies. Please look at https://github.com/costastf/mapscookiegettercli/blob/master/USAGE.rst for usage (it is quite simple 😃 ) and report issues at the tracker.