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

AttributeError: 'NoneType' object has no attribute 'get' #219

Open
axlan opened this issue Feb 10, 2021 · 19 comments
Open

AttributeError: 'NoneType' object has no attribute 'get' #219

axlan opened this issue Feb 10, 2021 · 19 comments

Comments

@axlan
Copy link

axlan commented Feb 10, 2021

I'm getting this error after I tap yes on my phone to allow the access

➜  aws-google-auth -S 115297745755 -I C02x4yyeb -p default -a --no-cache -u MY_EMAIL
AWS Region: us-west-2
Google Password:
Please visit the following URL to view your CAPTCHA: https://accounts.google.com/Captcha?v=2&ctoken=AAWk9lSGYtUyQjvELZ8fqND_7rJZEuFhLmcERBbgw1kjyEhmvqHBxbigHlUDhwikBUAi1nSp7ftByXuucicqSQLKBXgYhlLlPr4rC4gGt4WXkzctiFolbN0j7Tdsv2JyGmTwA9rYEoNCbzwUsWlaHg96AghiucmjuIZ8jVtRw4RzCI4yvboHpMF0NHcYJj6VlaxnoBZlnvlK
Captcha (case insensitive): cubscrout
Open the Google App, and tap 'Yes' on the prompt to sign in ...
ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/google.py", line 325, in do_login
    sess = self.handle_prompt(sess)
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/google.py", line 626, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'
@Wingjam
Copy link

Wingjam commented Feb 13, 2021

Same issue with:

  • aws-google-auth: 0.0.37 (installed via brew)
  • Python: 3.9.1
  • MacOS: 11.2.1
➜  aws-google-auth -k
Open the Google App, and tap 'Yes' on the prompt to sign in ...
ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/google.py", line 324, in do_login
    sess = self.handle_prompt(sess)
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/google.py", line 619, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'

@Wingjam
Copy link

Wingjam commented Feb 14, 2021

Workaround, login with version 0.0.36 using docker

docker run -it -v ~/.aws:/root/.aws cevoaustralia/aws-google-auth:0.0.36 -p default

@monkora
Copy link

monkora commented Feb 15, 2021

Rolling back to 0.0.36 worked for me

@slikk66
Copy link

slikk66 commented Feb 19, 2021

Just ran into this too, I was able to do (using zsh and mac)

sudo pip3 uninstall "aws-google-auth[u2f]"
sudo pip3 install "aws-google-auth[u2f]==0.0.36"

and it's working again

@claudiopablo
Copy link

I'm installed the 0.0.36 version, but don't work form me.

@maxalves
Copy link

maxalves commented Apr 12, 2022

Not working for me either, even with 0.0.36 version
chip: m1
macos: 12.3
python 3.9.12

Docker didn't work as well.

@paulorgl
Copy link

Same problem in here.
chip: intel
macos: 10.9
phyton: 3.10.14

@wwalsh-digitary
Copy link

Hello,

I am getting the same error using:
chip: intel
macos: 12.3
python: 3.9 or 3.6

I am printing the HTML page that the tool processes to retrieve the challengeId:
image

@Riyanat
Copy link

Riyanat commented Apr 28, 2022

same. I get the javascript error too. Tool previously worked fine.

@wwalsh-digitary
Copy link

Fix listed here: d7d7001

Steps to fix:
=========

Create a patch file from this text, call it aws-google-auth.patch (exclude the surrounding dashes):
--------------------------------------------------------------------
--- /opt/homebrew/lib/python3.9/site-packages/aws_google_auth/google.py	2022-04-27 10:25:42.000000000 +1000
+++ /opt/homebrew/lib/python3.9/site-packages/aws_google_auth/google.py	2022-04-27 10:23:35.000000000 +1000
@@ -264,6 +264,12 @@
         # Update the payload
         payload['Passwd'] = self.config.password
 
+        # Set bg_response in request payload to passwd challenge
+        if self.config.bg_response:
+            payload['bgresponse'] = self.config.bg_response
+
+
+
         # POST to Authenticate Password
         sess = self.post(passwd_challenge_url, data=payload)
--------------------------------------------------------------------


# Check what version you have installed
pip -V && pip3 -V && python -V && aws-google-auth -V

# If aws-google-auth isn't 0.0.37, then install it:
pip uninstall aws-google-auth
pip install   aws-google-auth==0.0.37

# Finally get aws-google-auth path
PATH_TO_PYTHON_PACKAGE=$(pip3 show aws_google_auth|grep "Location"|cut -d " " -f 2)

# Display path
echo $PATH_TO_PYTHON_PACKAGE

# Patch the file using the downloaded .patch file present in ticket DCS-1593
sudo patch $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py aws-google-auth.patch

# Check if the patch was applied - this shows the diff between the orig file and patched file
diff $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py.orig

This fix only worked for aws-google-auth v0.0.37.

@Hey-ItsFizban
Copy link

Update to aws-google-auth v0.0.38, at least that's what worked for me.

@scolebrook
Copy link

Seeing this issue on freshly installed 0.0.38 on python 3.9.12 with an OTP protected account. Also tried downgrading to 0.0.36 and 37. No changes.

The SAML response shows the same javascript message depicted above: "The browser you’re using doesn’t support JavaScript..."

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/google.py", line 256, in do_login
    passwd_challenge_url = 'https://accounts.google.com' + form.get('action')
AttributeError: 'NoneType' object has no attribute 'get'

@Wingjam
Copy link

Wingjam commented May 17, 2022

Like mentioned in other issues, did you tried: aws-google-auth --bg-response js_enabled ?

For debugging purpose, also add the following arguments: --save-failure-html -l debug

@scolebrook
Copy link

@Wingjam Thanks so much. That was it.

@Math2Compute
Copy link

I had the following stacktrace:

ERROR:root:'NoneType' object has no attribute 'find_all'
Traceback (most recent call last):
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\__init__.py", line 79, in cli
    process_auth(args, config)
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\__init__.py", line 243, in process_auth
    google_client.do_login()
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\google.py", line 291, in do_login
    sess = self.handle_captcha(sess, payload)
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\google.py", line 432, in handle_captcha
    for tag in form.find_all('input'):
AttributeError: 'NoneType' object has no attribute 'find_all'

Upgrading to aws-google-auth v0.0.38 fixed it, as suggested @Hey-ItsFizban

@Elvis020
Copy link

Elvis020 commented Jun 6, 2022

I was able to resolve the issue with the ff cmdline aws-google-auth -I <IDP_ID> -S <SP_ID> -R <region> -d 3600 -u <username/email> --bg-response js_enabled and getting the captcha after this resolved the issue. 😊

@nql6692
Copy link

nql6692 commented Nov 15, 2022

Like mentioned in other issues, did you tried: aws-google-auth --bg-response js_enabled ?

For debugging purpose, also add the following arguments: --save-failure-html -l debug

Thanks, it worked for me

@jarten-mlg
Copy link

jarten-mlg commented Jun 7, 2024

This issue is now impacting me for the first time running version 0.0.38. Tried all of the above suggestions, none of them have worked. Anyone else experiencing this?

@djuneja-uptycs
Copy link

@jarten-mlg I am also facing this. No suggestions have worked so far. Surprisingly the issue is not assigned to anyone, I don't think anyone is looking into this.

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