persandstrom / python-verisure

A python module for reading and changing status of verisure devices through verisure app api.
MIT License
138 stars 42 forks source link

MFA broken? #151

Closed joszz closed 1 year ago

joszz commented 1 year ago

I've used this API successfully for some time, but today I noticed it broke doing the MFA verification.

I'm not sure if it's because of the update to version 2.5.3, or something changed @ the verisure API side. After waiting some time I get the error below. If I can provide any more info, or if I have to test in another way, please tell me :)

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/verisure/__main__.py", line 136, in cli
    result = session.request(*queries)
  File "/usr/local/lib/python3.9/dist-packages/verisure/session.py", line 243, in request
    response = self._post(
  File "/usr/local/lib/python3.9/dist-packages/verisure/session.py", line 108, in wrapper
    raise ResponseError(response.status_code, response.text)
verisure.session.ResponseError: Invalid response, status code: 504 - Data: <html>
<head>
<title>Verisure APIGW</title>
</head>
<body>
<h1>Verisure API Gateway</h1>
<hr>
<p>Welcome to the Verisure API Gateway</p>
</body>
</html>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/vsure", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/verisure/__main__.py", line 140, in cli
    print(ex.text)
AttributeError: 'ResponseError' object has no attribute 'text'
ptz0n commented 1 year ago

HTTP 504 - Verisure's fault.

joszz commented 1 year ago

MFA does seem to work with the app or on verisures own website though... So I'm not 100% convinced it is a verisure problem. Maybe they just sent a 504 but block the request coming from anything other than first party software or something to that extent?

persandstrom commented 1 year ago

MFA works fine for me.

Error 504 is a gateway timeout error, but the content seems strange I must say.

Do you still get the error? Have tried to remove the cookie file ~/.verisure-cookie?

joszz commented 1 year ago

I still get the error. I forgot to mention a crucial detail it seems, my bad; problem only seems to occur inside a docker container and not on the host. Although before it worked perfectly fine in the same container. Something must've changed, unsure of what (not the firewall or anything obvious it seems). must be an issue on my end, but still clueless. Doesn't seem to work with host networking as well, which makes things even stranger...

I did remove the cookie. I get to entering the verification code and then receive the timeout

joszz commented 1 year ago

I'll close this for now since it's most likely an issue somewhere on my end. Will investigate further