aws-google-auth icon indicating copy to clipboard operation
aws-google-auth copied to clipboard

New flag `--save-all-html` to record all html content.

Open stevemac007 opened this issue 4 years ago • 5 comments

Add logic to trap all GET and POST calls for debug purposes.

stevemac007 avatar Apr 13 '20 12:04 stevemac007

Great idea 👍

max-rocket-internet avatar Apr 14 '20 07:04 max-rocket-internet

When trying this branch to debug my own problem related I guess to #179 I get

ERROR:root:write() argument must be str, not bytes
Traceback (most recent call last):
  File "/home/vide/tmp/aws-google-auth/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/home/vide/tmp/aws-google-auth/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/home/vide/tmp/aws-google-auth/aws_google_auth/google.py", line 188, in do_login
    sess = self.get(self.login_url)
  File "/home/vide/tmp/aws-google-auth/aws_google_auth/google.py", line 123, in get
    out.write(response.text.encode('utf-8'))
TypeError: write() argument must be str, not bytes

but if I print before on stdout response.text I do see the HTML

vide avatar Apr 15 '20 09:04 vide

@vide if you drop .encode('utf-8') from these lines:

https://github.com/cevoaustralia/aws-google-auth/blob/d6dfdb6be873f507bf075699fcb868902635dc98/aws_google_auth/google.py#L100

and

https://github.com/cevoaustralia/aws-google-auth/blob/d6dfdb6be873f507bf075699fcb868902635dc98/aws_google_auth/google.py#L122

Does the error persist?

jack1902 avatar Apr 23 '20 10:04 jack1902

@jack1902 yeah removing the encode('utf-8') works, I tried it before reporting but only on L122 and then I didn't see it was complaining about L100. Removing it in both places works as expected, I get the files saved to disk

vide avatar Apr 23 '20 11:04 vide

wondering if using the -l/--log level would be better to reduce the number of flags the tool has?

I tend to use --log debug --save-failure-html together when debugging. Wondering what others think?

jack1902 avatar Apr 23 '20 13:04 jack1902