rbx 3.19.2.dev172__tar.gz → 3.20.0.dev175__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/PKG-INFO +1 -1
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/pyproject.toml +2 -2
- rbx-3.20.0.dev175/rbx/__init__.py +1 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/__init__.py +10 -3
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/retry.py +6 -2
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/exceptions.py +10 -4
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/web/handlers.py +20 -1
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/PKG-INFO +1 -1
- rbx-3.19.2.dev172/rbx/__init__.py +0 -1
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/LICENSE +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/README.md +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/auth/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/auth/decorators.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/auth/id_token.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/auth/keystore.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/auth/mock.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/aws/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/aws/s3.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/cli.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/tasks/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/tasks/ec2.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/tasks/image.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/buildtools/tasks/misc.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/adsquare.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/broadsign.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/oxr.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/panels.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/clients/reporting.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/gcp/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/gcp/cloud_tasks.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/gcp/pubsub.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/gcp/storage.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/logging.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/settings.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/utils/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/utils/mdm.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/utils/vast.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx/web/__init__.py +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/SOURCES.txt +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/dependency_links.txt +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/entry_points.txt +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/requires.txt +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/rbx.egg-info/top_level.txt +0 -0
- {rbx-3.19.2.dev172 → rbx-3.20.0.dev175}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rbx"
|
|
7
|
-
version = "3.
|
|
7
|
+
version = "3.20.0.dev175"
|
|
8
8
|
description = "A collection of common tools for Scoota services."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "The Scoota Engineering Team", email = "engineering@scoota.com" }
|
|
@@ -80,7 +80,7 @@ homepage = "https://github.com/rockabox/rbx"
|
|
|
80
80
|
repository = "https://github.com/rockabox/rbx.git"
|
|
81
81
|
|
|
82
82
|
[tool.bumpversion]
|
|
83
|
-
current_version = "3.
|
|
83
|
+
current_version = "3.20.0.dev175"
|
|
84
84
|
commit = true
|
|
85
85
|
parse = """
|
|
86
86
|
(?P<major>\\d+)\\.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "3.20.0.dev175"
|
|
@@ -11,8 +11,9 @@ from requests.exceptions import ConnectionError, Timeout
|
|
|
11
11
|
from ..exceptions import (
|
|
12
12
|
ClientError,
|
|
13
13
|
Forbidden,
|
|
14
|
+
RequestTimeout,
|
|
14
15
|
ServerError,
|
|
15
|
-
|
|
16
|
+
TooManyRequests,
|
|
16
17
|
Unauthorized,
|
|
17
18
|
)
|
|
18
19
|
from ..utils import Singleton
|
|
@@ -174,7 +175,7 @@ class Client(metaclass=Singleton):
|
|
|
174
175
|
else:
|
|
175
176
|
response = getattr(requests, method)(url, **args)
|
|
176
177
|
except (ConnectionError, Timeout) as e:
|
|
177
|
-
raise
|
|
178
|
+
raise RequestTimeout(message=str(e), url=url)
|
|
178
179
|
|
|
179
180
|
# Never include the password field in the log on failure
|
|
180
181
|
payload = copy(data)
|
|
@@ -182,7 +183,7 @@ class Client(metaclass=Singleton):
|
|
|
182
183
|
payload.pop("password", None)
|
|
183
184
|
|
|
184
185
|
if response.status_code == 500:
|
|
185
|
-
raise
|
|
186
|
+
raise ServerError(response.text, details=payload, url=url)
|
|
186
187
|
|
|
187
188
|
if response.status_code == 401:
|
|
188
189
|
raise Unauthorized(self.get_message(response), details=payload, url=url)
|
|
@@ -190,6 +191,12 @@ class Client(metaclass=Singleton):
|
|
|
190
191
|
if response.status_code == 403:
|
|
191
192
|
raise Forbidden(self.get_message(response), details=payload, url=url)
|
|
192
193
|
|
|
194
|
+
if response.status_code == 408:
|
|
195
|
+
raise RequestTimeout(self.get_message(response), details=payload, url=url)
|
|
196
|
+
|
|
197
|
+
if response.status_code == 429:
|
|
198
|
+
raise TooManyRequests(self.get_message(response), details=payload, url=url)
|
|
199
|
+
|
|
193
200
|
if response.status_code >= 400:
|
|
194
201
|
raise ClientError(
|
|
195
202
|
response.text,
|
|
@@ -49,12 +49,16 @@ def if_exception_type(*exception_types):
|
|
|
49
49
|
"""A predicate that checks if an exception is a transient error.
|
|
50
50
|
|
|
51
51
|
The following server errors are considered transient:
|
|
52
|
+
- rbx.exceptions.RequestTimeout
|
|
53
|
+
- rbx.exceptions.ServerError
|
|
54
|
+
- rbx.exceptions.TooManyRequests
|
|
52
55
|
- rbx.exceptions.TransientException
|
|
53
|
-
- rbx.exceptions.TransientServerError
|
|
54
56
|
"""
|
|
55
57
|
if_transient_error = if_exception_type(
|
|
58
|
+
exceptions.RequestTimeout,
|
|
59
|
+
exceptions.ServerError,
|
|
60
|
+
exceptions.TooManyRequests,
|
|
56
61
|
exceptions.TransientException,
|
|
57
|
-
exceptions.TransientServerError,
|
|
58
62
|
)
|
|
59
63
|
|
|
60
64
|
|
|
@@ -72,12 +72,14 @@ class Forbidden(ClientException):
|
|
|
72
72
|
status_code = 403
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
class
|
|
76
|
-
|
|
75
|
+
class RequestTimeout(ClientException):
|
|
76
|
+
message = "Request Timeout"
|
|
77
|
+
status_code = 408
|
|
77
78
|
|
|
78
79
|
|
|
79
|
-
class
|
|
80
|
-
"
|
|
80
|
+
class TooManyRequests(ClientException):
|
|
81
|
+
message = "Too Many Requests"
|
|
82
|
+
status_code = 429
|
|
81
83
|
|
|
82
84
|
|
|
83
85
|
class Unauthorized(ClientException):
|
|
@@ -104,6 +106,10 @@ class RetryError(ClientException):
|
|
|
104
106
|
return f"{self.message}, last exception: {self.cause}"
|
|
105
107
|
|
|
106
108
|
|
|
109
|
+
class ServerError(HTTPException):
|
|
110
|
+
"""5xx server errors."""
|
|
111
|
+
|
|
112
|
+
|
|
107
113
|
class TransientException(Exception):
|
|
108
114
|
"""Raise this exception when we know the cause is transient (e.g.: connection errors,
|
|
109
115
|
consistency error, ...).
|
|
@@ -4,7 +4,7 @@ from flask import jsonify, request
|
|
|
4
4
|
from google.cloud.error_reporting import Client
|
|
5
5
|
from google.cloud.error_reporting.util import build_flask_context
|
|
6
6
|
|
|
7
|
-
from ..exceptions import BadRequest
|
|
7
|
+
from ..exceptions import BadRequest, TransientException
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def register_error_handlers(app):
|
|
@@ -46,12 +46,24 @@ def register_error_handlers(app):
|
|
|
46
46
|
response.status_code = 405
|
|
47
47
|
return response
|
|
48
48
|
|
|
49
|
+
@app.errorhandler(408)
|
|
50
|
+
def request_timeout(error):
|
|
51
|
+
response = jsonify(message="Request Timeout")
|
|
52
|
+
response.status_code = 408
|
|
53
|
+
return response
|
|
54
|
+
|
|
49
55
|
@app.errorhandler(415)
|
|
50
56
|
def unsupported_media_type(error):
|
|
51
57
|
response = jsonify(message="Unsupported Media Type")
|
|
52
58
|
response.status_code = 415
|
|
53
59
|
return response
|
|
54
60
|
|
|
61
|
+
@app.errorhandler(429)
|
|
62
|
+
def too_many_requests(error):
|
|
63
|
+
response = jsonify(message="Too Many Requests")
|
|
64
|
+
response.status_code = 429
|
|
65
|
+
return response
|
|
66
|
+
|
|
55
67
|
# BadRequest exceptions
|
|
56
68
|
@app.errorhandler(BadRequest)
|
|
57
69
|
def invalid_exception(error):
|
|
@@ -60,6 +72,13 @@ def register_error_handlers(app):
|
|
|
60
72
|
response.status_code = error.status_code
|
|
61
73
|
return response
|
|
62
74
|
|
|
75
|
+
# TransientException exceptions
|
|
76
|
+
@app.errorhandler(TransientException)
|
|
77
|
+
def transient_exception(error):
|
|
78
|
+
response = jsonify(message="Request Timeout")
|
|
79
|
+
response.status_code = 408
|
|
80
|
+
return response
|
|
81
|
+
|
|
63
82
|
# Uncaught exceptions
|
|
64
83
|
@app.errorhandler(Exception)
|
|
65
84
|
def unhandled_exception(error):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "3.19.2.dev172"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|