Merge branch 'v1'

This commit is contained in:
Mads Marquart
2020-01-25 14:03:53 +01:00
2 changed files with 7 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ class InvalidParameters(ExternalError):
class NotLoggedIn(ExternalError):
"""Raised by Facebook if the client has been logged out."""
code = attr.ib(1357001)
code = attr.ib()
@attr.s(slots=True, auto_exc=True)

View File

@@ -168,10 +168,10 @@ class Listener:
(j,) = session._graphql_requests(
_graphql.from_doc_id("1349387578499440", params)
)
try:
return int(j["viewer"]["message_threads"]["sync_sequence_id"])
except (KeyError, ValueError) as e:
raise _exception.ParseError("Could not find sequence id", data=j) from e
sequence_id = j["viewer"]["message_threads"]["sync_sequence_id"]
if not sequence_id:
raise _exception.NotLoggedIn("Failed fetching sequence id")
return int(sequence_id)
def _on_connect_handler(self, client, userdata, flags, rc):
if rc == 21:
@@ -321,6 +321,8 @@ class Listener:
# This error is wrongly classified
# See https://github.com/eclipse/paho.mqtt.python/issues/340
log.warning("Connection error, retrying")
elif rc == paho.mqtt.client.MQTT_ERR_CONN_REFUSED:
raise _exception.NotLoggedIn("MQTT connection refused")
else:
err = paho.mqtt.client.error_string(rc)
log.error("MQTT Error: %s", err)