From ec67d9780943e8c6659bd8986eb0784a411a6231 Mon Sep 17 00:00:00 2001 From: Kevin Fronczak Date: Fri, 5 Feb 2021 15:11:03 +0000 Subject: [PATCH] Add content type to header to fix downloading --- blinkpy/auth.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/blinkpy/auth.py b/blinkpy/auth.py index bc61387..c7e997b 100644 --- a/blinkpy/auth.py +++ b/blinkpy/auth.py @@ -58,7 +58,11 @@ class Auth: """Return authorization header.""" if self.token is None: return None - return {"TOKEN_AUTH": self.token, "user-agent": DEFAULT_USER_AGENT} + return { + "TOKEN_AUTH": self.token, + "user-agent": DEFAULT_USER_AGENT, + "content-type": "application/json", + } def create_session(self, opts=None): """Create a session for blink communication.""" @@ -227,6 +231,9 @@ class Auth: try: json_resp = response.json() blink.available = json_resp["valid"] + if not json_resp["valid"]: + _LOGGER.error(f"{json_resp['message']}") + return False except (KeyError, TypeError): _LOGGER.error("Did not receive valid response from server.") return False