4

the python code I tried to work with, simplified the most I could is:

import requests params = { 'Email': '[email protected]', 'EncryptedPasswd': 'longEncryptedPassword' } response = requests.post('https://android.clients.google.com/auth', data=params) print(response.status_code) print(response.content) 

Now when I trying to run that code on any of my hosts, it works fine:

ᐅ python -VV Python 3.7.2 (default, Apr 23 2021, 12:30:59) [GCC 10.2.0] ᐅ python test.py 200 b'SID=BAD_COOKIE\nLSID=BAD_COOKIE\nservices=mail,hist,multilogin,android' --- atay@atay$ ~ ᐅ python3 -VV Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] atay@atay$ ~ ᐅ python3 test.py 200 b'SID=BAD_COOKIE\nLSID=BAD_COOKIE\nservices=mail,hist,multilogin,android' --- pi@raspberrypi$ ~ ᐅ python3 -VV Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] pi@raspberrypi$ ~ ᐅ python3 test.py 200 b'SID=BAD_COOKIE\nLSID=BAD_COOKIE\nservices=mail,hist,multilogin,android' 

but when trying to run same code on docker I've got error response:

docker run -v $(pwd):/app python:3.7.2 sh -c 'pip install requests && python -VV && python /app/test.py' ... Python 3.7.2 (default, Mar 27 2019, 08:41:08) [GCC 6.3.0 20170516] 403 b'Error=BadAuthentication' 

What is also not understandable for me - if I use curlify to create curl that IMO should be identical to that call - it returns 403 instead of 200.

Another thing - if I create same request in Postman, it returns 200, but if I export it in Postman to CURL command, it returns 403 again.

I'm not sure what can be the issue in this case, any clues?

1

1 Answer 1

1

I'll answer myself, as I found the solution, but still do not understand what's wrong.

Looks like pip library requests>=2.25.0 does not work, but all the earlier version works, so changing code to:

ᐅ docker run -v $(pwd):/app python:3.9 sh -c 'pip install requests==2.25.0 && openssl version && python -VV && python /app/test.py' 

makes it work. Also OpenSSL must be 1.1.1, that's why I use 3.9, instead of 3.7.2.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.