Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-gTTS-token for
openSUSE:Factory checked in at 2022-09-29 18:14:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-gTTS-token (Old)
and /work/SRC/openSUSE:Factory/.python-gTTS-token.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-gTTS-token"
Thu Sep 29 18:14:20 2022 rev:4 rq:1006900 version:1.1.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-gTTS-token/python-gTTS-token.changes
2018-12-03 10:12:17.475603465 +0100
+++
/work/SRC/openSUSE:Factory/.python-gTTS-token.new.2275/python-gTTS-token.changes
2022-09-29 18:15:10.083467845 +0200
@@ -1,0 +2,9 @@
+Wed Sep 28 19:49:55 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- 1.1.4 - 2020-11-09
+ * Switch to latest python
+ * Fix regex deprecation
+ * Allow custom country code (Thanks @onsunl)
+ * Add retry mechanism (Thanks @w2sv)
+
+-------------------------------------------------------------------
Old:
----
gTTS-token-1.1.3.tar.gz
New:
----
gTTS-token-1.1.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-gTTS-token.spec ++++++
--- /var/tmp/diff_new_pack.AMd2PY/_old 2022-09-29 18:15:10.567468795 +0200
+++ /var/tmp/diff_new_pack.AMd2PY/_new 2022-09-29 18:15:10.575468811 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-gTTS-token
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,12 +18,12 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-gTTS-token
-Version: 1.1.3
+Version: 1.1.4
Release: 0
Summary: Python module for calculating a token to run the Google
text-to-speech engine
License: MIT
Group: Development/Languages/Python
-Url: https://github.com/boudewijn26/gTTS-token
+URL: https://github.com/boudewijn26/gTTS-token
Source:
https://files.pythonhosted.org/packages/source/g/gTTS-token/gTTS-token-%{version}.tar.gz
BuildRequires: %{python_module setuptools}
BuildRequires: dos2unix
++++++ gTTS-token-1.1.3.tar.gz -> gTTS-token-1.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gTTS-token-1.1.3/PKG-INFO
new/gTTS-token-1.1.4/PKG-INFO
--- old/gTTS-token-1.1.3/PKG-INFO 2018-11-29 17:53:48.000000000 +0100
+++ new/gTTS-token-1.1.4/PKG-INFO 2020-11-09 18:27:26.790721700 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: gTTS-token
-Version: 1.1.3
+Version: 1.1.4
Summary: Calculates a token to run the Google Translate text to speech
Home-page: https://github.com/boudewijn26/gTTS-token
Author: Boudewijn van Groos
@@ -35,3 +35,4 @@
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
+Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gTTS-token-1.1.3/gTTS_token.egg-info/PKG-INFO
new/gTTS-token-1.1.4/gTTS_token.egg-info/PKG-INFO
--- old/gTTS-token-1.1.3/gTTS_token.egg-info/PKG-INFO 2018-11-29
17:53:48.000000000 +0100
+++ new/gTTS-token-1.1.4/gTTS_token.egg-info/PKG-INFO 2020-11-09
18:27:26.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: gTTS-token
-Version: 1.1.3
+Version: 1.1.4
Summary: Calculates a token to run the Google Translate text to speech
Home-page: https://github.com/boudewijn26/gTTS-token
Author: Boudewijn van Groos
@@ -35,3 +35,4 @@
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
+Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gTTS-token-1.1.3/gtts_token/gtts_token.py
new/gTTS-token-1.1.4/gtts_token/gtts_token.py
--- old/gTTS-token-1.1.3/gtts_token/gtts_token.py 2018-11-29
17:49:00.000000000 +0100
+++ new/gTTS-token-1.1.4/gtts_token/gtts_token.py 2020-11-09
18:20:40.000000000 +0100
@@ -15,8 +15,15 @@
SALT_1 = "+-a^+6"
SALT_2 = "+-3^+b+-f"
- def __init__(self):
+
+ def __init__(self, max_retries=5, country_domain_name='com'):
+ """
+ :param max_retries: int Number of conducted token key retrieval retries
+ before error will be thrown """
self.token_key = None
+ self.country_domain_name = country_domain_name
+ self._max_retries = max_retries
+
def calculate_token(self, text, seed=None):
""" Calculate the request token (`tk`) of a string
@@ -25,7 +32,10 @@
"""
if seed is None:
- seed = self._get_token_key()
+ if self.token_key is None:
+ seed = self._get_token_key()
+ else:
+ seed = self.token_key
[first_seed, second_seed] = seed.split(".")
@@ -48,27 +58,29 @@
a = int(a)
return str(a) + "." + str(a ^ int(first_seed))
- def _get_token_key(self):
- if self.token_key is not None:
- return self.token_key
-
- response = requests.get("https://translate.google.com/")
+ def _get_token_key(self, retry=0):
+ response = requests.get("https://translate.google.%s/" %
self.country_domain_name)
tkk_expr = re.search("(tkk:.*?),", response.text)
- if not tkk_expr:
- raise ValueError(
- "Unable to find token seed! Did https://translate.google.com
change?"
- )
+
+ if tkk_expr is None:
+ if retry == self._max_retries:
+ raise ValueError(
+ "Unable to find token seed! Did
https://translate.google.com change?"
+ )
+ else:
+ return self._get_token_key(retry=retry + 1)
+
tkk_expr = tkk_expr.group(1)
try:
# Grab the token directly if already generated by function call
- result = re.search("\d{6}\.[0-9]+", tkk_expr).group(0)
+ result = re.search(r"\d{6}\.[0-9]+", tkk_expr).group(0)
except AttributeError:
# Generate the token using algorithm
timestamp = calendar.timegm(time.gmtime())
hours = int(math.floor(timestamp / 3600))
- a = re.search("a\\\\x3d(-?\d+);", tkk_expr).group(1)
- b = re.search("b\\\\x3d(-?\d+);", tkk_expr).group(1)
+ a = re.search(r"a\\\\x3d(-?\d+);", tkk_expr).group(1)
+ b = re.search(r"b\\\\x3d(-?\d+);", tkk_expr).group(1)
result = str(hours) + "." + str(int(a) + int(b))
@@ -85,4 +97,4 @@
d = ord(char[0]) - 87 if char >= "a" else int(char)
d = self._rshift(a, d) if seed[i + 1] == "+" else a << d
a = a + d & 4294967295 if seed[i] == "+" else a ^ d
- return a
+ return a
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gTTS-token-1.1.3/gtts_token/version.py
new/gTTS-token-1.1.4/gtts_token/version.py
--- old/gTTS-token-1.1.3/gtts_token/version.py 2018-11-29 17:49:00.000000000
+0100
+++ new/gTTS-token-1.1.4/gtts_token/version.py 2020-11-09 18:21:47.000000000
+0100
@@ -1 +1 @@
-__version__ = '1.1.3'
+__version__ = '1.1.4'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gTTS-token-1.1.3/setup.py
new/gTTS-token-1.1.4/setup.py
--- old/gTTS-token-1.1.3/setup.py 2018-09-21 23:05:59.000000000 +0200
+++ new/gTTS-token-1.1.4/setup.py 2020-11-09 18:27:20.000000000 +0100
@@ -15,6 +15,7 @@
license='MIT',
description='Calculates a token to run the Google Translate text to
speech',
long_description=open('README.md').read(),
+ long_description_content_type="text/markdown",
install_requires=[
"requests"
],