Skip to content

Commit df9927f

Browse files
committed
Use authentication timeout in token URL requests
1 parent e0f85f4 commit df9927f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

emailproxy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
2.0 authentication. Designed for apps/clients that don't support OAuth 2.0 but need to connect to modern servers."""
55

66
__author__ = 'Simon Robinson'
7-
__copyright__ = 'Copyright (c) 2023 Simon Robinson'
7+
__copyright__ = 'Copyright (c) 2024 Simon Robinson'
88
__license__ = 'Apache 2.0'
9-
__version__ = '2023-12-22' # ISO 8601 (YYYY-MM-DD)
9+
__version__ = '2024-01-17' # ISO 8601 (YYYY-MM-DD)
1010
__package_version__ = '.'.join([str(int(i)) for i in __version__.split('-')]) # for pyproject.toml usage only
1111

1212
import abc
@@ -1052,7 +1052,7 @@ def get_oauth2_authorisation_tokens(token_url, redirect_uri, client_id, client_s
10521052
try:
10531053
response = urllib.request.urlopen(
10541054
urllib.request.Request(token_url, data=urllib.parse.urlencode(params).encode('utf-8'),
1055-
headers={'User-Agent': APP_NAME})).read()
1055+
headers={'User-Agent': APP_NAME}), timeout=AUTHENTICATION_TIMEOUT).read()
10561056
return json.loads(response)
10571057
except urllib.error.HTTPError as e:
10581058
e.message = json.loads(e.read())
@@ -1070,7 +1070,7 @@ def refresh_oauth2_access_token(token_url, client_id, client_secret, refresh_tok
10701070
try:
10711071
response = urllib.request.urlopen(
10721072
urllib.request.Request(token_url, data=urllib.parse.urlencode(params).encode('utf-8'),
1073-
headers={'User-Agent': APP_NAME})).read()
1073+
headers={'User-Agent': APP_NAME}), timeout=AUTHENTICATION_TIMEOUT).read()
10741074
return json.loads(response)
10751075
except urllib.error.HTTPError as e:
10761076
e.message = json.loads(e.read())

0 commit comments

Comments
 (0)