From 45a7da521ae90e2d34d08730b23258a95fdbb82d Mon Sep 17 00:00:00 2001 From: Diogo Silva <49190578+spamz23@users.noreply.github.com> Date: Sat, 2 Oct 2021 23:01:05 +0100 Subject: [PATCH 1/2] Fix GA_KEY_CONTENT OpenSSL crypto error Forked because original maintainer is not review pull requests This is the change proposed in: https://github.com/tomdyson/wagalytics/pull/44 --- wagalytics/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagalytics/views.py b/wagalytics/views.py index e048696..b92ecce 100755 --- a/wagalytics/views.py +++ b/wagalytics/views.py @@ -54,7 +54,7 @@ def get_access_token_from_str(ga_key_content): SCOPE = 'https://www.googleapis.com/auth/analytics.readonly' # Construct a credentials objects from the key data and OAuth2 scope. - keyDict = json.loads(ga_key_content.replace('\n', '').replace('\r', '')) + keyDict = json.loads(ga_key_content.replace('\n', '\\n')) _credentials = ServiceAccountCredentials.from_json_keyfile_dict( keyDict, SCOPE) From 941f9423f85a5fc38c187e02055d58228860951d Mon Sep 17 00:00:00 2001 From: Diogo Silva <49190578+spamz23@users.noreply.github.com> Date: Sat, 2 Oct 2021 23:46:27 +0100 Subject: [PATCH 2/2] Fix `GA_KEY_CONTENT` Error --- wagalytics/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagalytics/views.py b/wagalytics/views.py index b92ecce..ede98df 100755 --- a/wagalytics/views.py +++ b/wagalytics/views.py @@ -54,7 +54,7 @@ def get_access_token_from_str(ga_key_content): SCOPE = 'https://www.googleapis.com/auth/analytics.readonly' # Construct a credentials objects from the key data and OAuth2 scope. - keyDict = json.loads(ga_key_content.replace('\n', '\\n')) + keyDict = json.loads(ga_key_content, strict=False) _credentials = ServiceAccountCredentials.from_json_keyfile_dict( keyDict, SCOPE)