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.

TypeError: 'NoteType' object is not subscriptable when authenticating with 2FA (v3.0.11)

See original GitHub issue

Trying 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:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
costastfcommented, Jan 27, 2019

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.

0reactions
costastfcommented, Mar 25, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Math - 'NoneType' object is not subscriptable
The exception TypeError: 'NoneType' object is not subscriptable happens because the value of lista is actually None . You can reproduce TypeError that...
Read more >
Python TypeError: 'NoneType' object is not subscriptable
The “TypeError: 'NoneType' object is not subscriptable” error is raised when you try to access items from a None value using indexing. This...
Read more >
[Solved] TypeError: 'NoneType' Object is Not Subscriptable
The error, NoneType object is not subscriptable, means that you were trying to subscript a NoneType object. This resulted in a type error....
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/22 02 ...
... Bug:389017 - "dev-python/acutil - Tool for setting up authentication from ... Bug:571688 - "revdep-rebuild: 'NoneType' object is not subscriptable" ...
Read more >
Home-Assistant-Mail-And-Packages
After I setup mail and package it went though just fine but after setup it now says retrying setup: none and dose not...
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