From 57d26e4831d889fd85c54552db44ad6686d47d34 Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 21:29:10 +0200 Subject: [PATCH 01/10] Key for Jodel 4.82.1 and version bump --- setup.py | 2 +- src/jodel_api/jodel_api.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 861e7c2..bbff821 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ long_description = f.read() setup(name='jodel_api', - version='1.2.11', + version='1.2.12', description='Unoffical Python Interface to the Jodel API', long_description=long_description, url='https://github.com/nborrmann/jodel_api', diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index f982b31..471f25d 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -24,8 +24,8 @@ class JodelAccount: api_url = "https://api.go-tellm.com/api{}" client_id = '81e8a76e-1e02-4d17-9ba0-8a7020261b26' - secret = 'HtJoqSysGFQXgFqYZRgwbpcFVAzLFSioVKTCwMcL'.encode('ascii') - version = '4.79.1' + secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') + version = '4.82.1' secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') version_legacy = '4.47.0' From c0f53a5172176579c3b7ebce99de4d4fa6e83d1a Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 21:32:49 +0200 Subject: [PATCH 02/10] Ignore PyCharm IDE files. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 62c1e73..9d7d1dd 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,6 @@ ENV/ # Rope project settings .ropeproject + +# Pycharm IDE +.idea/ \ No newline at end of file From 6b09699328829b91dfe9b15fda819b4133eff16a Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 22:26:08 +0200 Subject: [PATCH 03/10] Added option to put Jodel key and version into environment variables. --- src/jodel_api/jodel_api.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index 471f25d..b0ffe85 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -15,6 +15,7 @@ from urllib.parse import urlparse from jodel_api import gcmhack import time +import os s = requests.Session() @@ -24,11 +25,16 @@ class JodelAccount: api_url = "https://api.go-tellm.com/api{}" client_id = '81e8a76e-1e02-4d17-9ba0-8a7020261b26' - secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') - version = '4.82.1' - secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') + secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') version_legacy = '4.47.0' + if os.environ.get('JODEL_API_JODELKEY') == None or os.environ.get('JODEL_API_JODELVERSION') == None: + secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') + version = '4.82.1' + else: + secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') + version = os.environ.get('JODEL_API_JODELVERSION') + access_token = None device_uid = None From 3ff5f3972616f640f708779734e044825c63f7d0 Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 22:33:06 +0200 Subject: [PATCH 04/10] Added remark about the ability to set the signing key and version through environment variables. --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b7fbcf5..5b74278 100644 --- a/README.rst +++ b/README.rst @@ -230,7 +230,9 @@ Error Codes to one specific endpoint. - **477 "Signed Request Expected"**: This library should handle request signing. Make sure to upgrade to the latest version of ``jodel_api``, - as the signing key changes every few weeks. + as the signing key changes every few weeks. You can set the signing key + and version manually through these environment variables: + JODEL_API_JODELKEY and JODEL_API_JODELVERSION - **478 "Account not verified"**: Verify the account through GCM. - **502 "Bad Gateway"**: Something went wrong server-side. This happens pretty randomly. ``jodel_api`` automatically retries two times when From 46cb580cf23985b6e533ef45f057084314627dff Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 22:54:21 +0200 Subject: [PATCH 05/10] Added version check for environment variable supplied Jodel Key --- src/jodel_api/jodel_api.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index b0ffe85..9ffc22a 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -16,6 +16,7 @@ from jodel_api import gcmhack import time import os +import re s = requests.Session() @@ -25,15 +26,18 @@ class JodelAccount: api_url = "https://api.go-tellm.com/api{}" client_id = '81e8a76e-1e02-4d17-9ba0-8a7020261b26' - secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') + secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') version_legacy = '4.47.0' + secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') + version = '4.82.1' - if os.environ.get('JODEL_API_JODELKEY') == None or os.environ.get('JODEL_API_JODELVERSION') == None: - secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') - version = '4.82.1' - else: - secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') - version = os.environ.get('JODEL_API_JODELVERSION') + if not (os.environ.get('JODEL_API_JODELKEY') == None or os.environ.get('JODEL_API_JODELVERSION') == None): + ver_environ = [int(s) for s in re.findall(r'\b\d+\b', os.environ.get('JODEL_API_JODELVERSION'))] + ver_builtin = [int(s) for s in re.findall(r'\b\d+\b', version)] + + if ver_environ[0] >= ver_builtin[0] and ver_environ[1] >= ver_builtin[1] and ver_environ[2] > ver_builtin[2]: + secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') + version = os.environ.get('JODEL_API_JODELVERSION') access_token = None From 467bf91a33ec0ea38c5aa6ed32ed5fa5bec3bdaf Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 22:57:14 +0200 Subject: [PATCH 06/10] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5b74278..23c0ca0 100644 --- a/README.rst +++ b/README.rst @@ -232,7 +232,7 @@ Error Codes signing. Make sure to upgrade to the latest version of ``jodel_api``, as the signing key changes every few weeks. You can set the signing key and version manually through these environment variables: - JODEL_API_JODELKEY and JODEL_API_JODELVERSION + JODEL_API_JODELKEY and JODEL_API_JODELVERSION (jodel_api will prefer newer versions) - **478 "Account not verified"**: Verify the account through GCM. - **502 "Bad Gateway"**: Something went wrong server-side. This happens pretty randomly. ``jodel_api`` automatically retries two times when From 588f1d15b119f697a7e466a70129cee894b18c4b Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Fri, 13 Apr 2018 23:32:27 +0200 Subject: [PATCH 07/10] Fixed version evaluation. --- src/jodel_api/jodel_api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index 9ffc22a..f575186 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -31,13 +31,18 @@ class JodelAccount: secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') version = '4.82.1' + if not (os.environ.get('JODEL_API_JODELKEY') == None or os.environ.get('JODEL_API_JODELVERSION') == None): ver_environ = [int(s) for s in re.findall(r'\b\d+\b', os.environ.get('JODEL_API_JODELVERSION'))] ver_builtin = [int(s) for s in re.findall(r'\b\d+\b', version)] - if ver_environ[0] >= ver_builtin[0] and ver_environ[1] >= ver_builtin[1] and ver_environ[2] > ver_builtin[2]: - secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') - version = os.environ.get('JODEL_API_JODELVERSION') + for i in range(len(ver_environ)): + if ver_builtin[i] < ver_environ[i]: + secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') + version = os.environ.get('JODEL_API_JODELVERSION') + break + elif ver_builtin[i] > ver_environ[i]: + break access_token = None From 13b0e35697eef1a124b8bc6e6a49e3a28d641f00 Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Sat, 14 Apr 2018 17:03:37 +0200 Subject: [PATCH 08/10] Optimized imports --- src/jodel_api/jodel_api.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index f575186..6b9c588 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -15,8 +15,8 @@ from urllib.parse import urlparse from jodel_api import gcmhack import time -import os -import re +from os import environ +from re import findall s = requests.Session() @@ -32,14 +32,14 @@ class JodelAccount: version = '4.82.1' - if not (os.environ.get('JODEL_API_JODELKEY') == None or os.environ.get('JODEL_API_JODELVERSION') == None): - ver_environ = [int(s) for s in re.findall(r'\b\d+\b', os.environ.get('JODEL_API_JODELVERSION'))] - ver_builtin = [int(s) for s in re.findall(r'\b\d+\b', version)] + if not (environ.get('JODEL_API_JODELKEY') == None or environ.get('JODEL_API_JODELVERSION') == None): + ver_environ = [int(s) for s in findall(r'\b\d+\b', environ.get('JODEL_API_JODELVERSION'))] + ver_builtin = [int(s) for s in findall(r'\b\d+\b', version)] for i in range(len(ver_environ)): if ver_builtin[i] < ver_environ[i]: - secret = os.environ.get('JODEL_API_JODELKEY').encode('ascii') - version = os.environ.get('JODEL_API_JODELVERSION') + secret = environ.get('JODEL_API_JODELKEY').encode('ascii') + version = environ.get('JODEL_API_JODELVERSION') break elif ver_builtin[i] > ver_environ[i]: break From febebdd7193b8af0f9b20e9f13f2ec7fb12eebd9 Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Wed, 25 Apr 2018 23:56:35 +0200 Subject: [PATCH 09/10] Updated Jodel key and version. --- src/jodel_api/jodel_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jodel_api/jodel_api.py b/src/jodel_api/jodel_api.py index 6b9c588..dd8f96b 100644 --- a/src/jodel_api/jodel_api.py +++ b/src/jodel_api/jodel_api.py @@ -28,8 +28,8 @@ class JodelAccount: client_id = '81e8a76e-1e02-4d17-9ba0-8a7020261b26' secret_legacy = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'.encode('ascii') version_legacy = '4.47.0' - secret = 'oGJWWnyqVQiecgUejzUZSjXifrlGwWOJMreOGMIq'.encode('ascii') - version = '4.82.1' + secret = 'DKUdMXSujwAPihgJiMzHIDcXaxUNJwhBagBgBYlg'.encode('ascii') + version = '4.84.1' if not (environ.get('JODEL_API_JODELKEY') == None or environ.get('JODEL_API_JODELVERSION') == None): From fc9f5b7ea32ef137ac2fd462863d2bc195071030 Mon Sep 17 00:00:00 2001 From: wetterfroschdus Date: Thu, 26 Apr 2018 18:57:30 +0200 Subject: [PATCH 10/10] Fixed typo --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 23c0ca0..b3a385c 100644 --- a/README.rst +++ b/README.rst @@ -219,7 +219,7 @@ Error Codes - **401 "Unauthorized"**: Your ``access_token`` is invalid. Either you messed up, or it is outdated. You need to call - ``refresh_access_token()`` or ``refresh_all_token()`` (check the + ``refresh_access_token()`` or ``refresh_all_tokens()`` (check the above section on account creation). - **401 "Action not allowed"**: You are using a ``4.48`` account with ``is_legacy=True``, but ``4.48`` accounts are not allowed