From d30b44ee0f61f1fdb9bca606d3e29ff4dab3d8d6 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Sun, 26 Jan 2020 01:12:52 -0500 Subject: [PATCH] Minor formatting changes per codacy review. --- cps/kobo.py | 1 - cps/kobo_auth.py | 4 +++- cps/services/SyncToken.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 7e1cbc8e..f745a98a 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -31,7 +31,6 @@ from flask import ( request, make_response, jsonify, - json, url_for, redirect, ) diff --git a/cps/kobo_auth.py b/cps/kobo_auth.py index 60f3ea5f..48eee3cf 100644 --- a/cps/kobo_auth.py +++ b/cps/kobo_auth.py @@ -26,7 +26,9 @@ When first booting a Kobo device the user must sign into a Kobo (or affiliate) a Upon successful sign-in, the user is redirected to https://auth.kobobooks.com/CrossDomainSignIn?id= which serves the following response: - . + And triggers the insertion of a userKey into the device's User table. Together, the device's DeviceId and UserKey act as an *irrevocable* authentication diff --git a/cps/services/SyncToken.py b/cps/services/SyncToken.py index 21f16acc..903fff9a 100644 --- a/cps/services/SyncToken.py +++ b/cps/services/SyncToken.py @@ -84,7 +84,7 @@ class SyncToken(): @staticmethod def from_headers(headers): sync_token_header = headers.get(SyncToken.SYNC_TOKEN_HEADER, "") - if sync_token_header == "": + if not sync_token_header: return SyncToken() # On the first sync from a Kobo device, we may receive the SyncToken @@ -103,7 +103,7 @@ class SyncToken(): data_json = sync_token_json["data"] validate(sync_token_json, SyncToken.data_schema_v1) - except (exceptions.ValidationError, ValueError) as e: + except (exceptions.ValidationError, ValueError): log.error("Sync token contents do not follow the expected json schema.") return SyncToken()