rbignon/doctoshotgun

Error 401 with latest version

JB-CHAUVIN opened this issue · 5 comments

Hello,

I cloned the repository right now, and got a 401 error when running the script :

jbchauvin@MacBook-Pro ~/P/t/doctoshotgun> ./doctoshotgun.py Paris XXXX@gmail.com
Password:

Traceback (most recent call last):
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 506, in
sys.exit(Application().main())
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 437, in main
patients = docto.get_patients()
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 227, in get_patients
self.master_patient.go()
File "/usr/local/lib/python3.9/site-packages/woob/browser/url.py", line 98, in go
r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 911, in location
response = self.open(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 531, in open
response = self.session.send(preq,
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 57, in send
return callback(self, resp)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 560, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 401 Client Error: Unauthorized

Possibly related to #37 and/or #46?

It may be implemented now, can you test?

The TFA-Code doesn't seem to work for me either. I'm getting

/home/kai/PycharmProjects/doctoshotgun/venv/bin/python /home/kai/PycharmProjects/doctoshotgun/doctoshotgun.py de hamburg xxxx@gmail.com -z -d --dry-run
Password: 
2021-06-21 11:56:34,665:DEBUG:urllib3.connectionpool::connectionpool.py:971:_new_conn Starting new HTTPS connection (1): www.doctolib.de:443
2021-06-21 11:56:34,964:DEBUG:urllib3.connectionpool::connectionpool.py:452:_make_request https://www.doctolib.de:443 "GET /sessions/new HTTP/1.1" 200 None
2021-06-21 11:56:35,041:INFO:browser::browsers.py:369:save_response Response saved to 09a3132eb5f74a95a7340f09ebf95ee2
2021-06-21 11:56:35,045:DEBUG:browser::browsers.py:894:internal_callback Unable to handle https://www.doctolib.de/sessions/new
2021-06-21 11:56:35,879:DEBUG:urllib3.connectionpool::connectionpool.py:452:_make_request https://www.doctolib.de:443 "POST /login.json HTTP/1.1" 401 None
2021-06-21 11:56:35,883:INFO:browser::browsers.py:369:save_response Response saved to 721b2f9fe0b341f9b8c5fb59ba9910ee
Wrong login/password

The password is ok and works on the website with 2FA.

Same for me:
Traceback (most recent call last):
File "./doctoshotgun.py", line 632, in
sys.exit(Application().main())
File "./doctoshotgun.py", line 537, in main
patients = docto.get_patients()
File "./doctoshotgun.py", line 260, in get_patients
self.master_patient.go()
File "/usr/local/lib/python3.6/site-packages/woob/browser/url.py", line 98, in go
r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 911, in location
response = self.open(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 539, in open
is_async=is_async)
File "./doctoshotgun.py", line 60, in send
return callback(self, resp)
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "/usr/local/lib/python3.6/site-packages/woob/browser/browsers.py", line 560, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 401 Client Error: Unauthorized

Does your comments mean the script is not usable without TFA? For weblogin this is not needed for my account.

I am getting 2FA requests for every run of the script nowadays, but the implementation works flawlessly and with the --code CLI argument the code is reusable for multiple runs.