tilebox-grpc 0.39.0__tar.gz → 0.41.0__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.
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/PKG-INFO +4 -4
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/error.py +36 -6
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/pyproject.toml +3 -3
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/.gitignore +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/README.md +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/__init__.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/__init__.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/channel.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/error.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/pagination.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/producer_consumer.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/aio/syncify.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/channel.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/pagination.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/producer_consumer.py +0 -0
- {tilebox_grpc-0.39.0 → tilebox_grpc-0.41.0}/_tilebox/grpc/replay.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilebox-grpc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.41.0
|
|
4
4
|
Summary: GRPC / Protocol Buffers functions for Tilebox
|
|
5
5
|
Project-URL: Homepage, https://tilebox.com
|
|
6
6
|
Project-URL: Documentation, https://docs.tilebox.com/
|
|
@@ -20,11 +20,11 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
20
20
|
Classifier: Topic :: Software Development
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Requires-Dist: anyio>=4
|
|
23
|
-
Requires-Dist: grpcio-status>=1.
|
|
24
|
-
Requires-Dist: grpcio>=1.
|
|
23
|
+
Requires-Dist: grpcio-status>=1.70
|
|
24
|
+
Requires-Dist: grpcio>=1.70
|
|
25
25
|
Requires-Dist: lz4>=4
|
|
26
26
|
Requires-Dist: nest-asyncio>=1.5.0
|
|
27
|
-
Requires-Dist: protobuf>=
|
|
27
|
+
Requires-Dist: protobuf>=6
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
|
|
30
30
|
<h1 align="center">
|
|
@@ -9,6 +9,14 @@ from grpc import RpcError, StatusCode
|
|
|
9
9
|
from grpc.aio import AioRpcError
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
class NetworkError(IOError):
|
|
13
|
+
"""NetworkError indicates that a network error occurred while communicating with the server"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NetworkTimeoutError(NetworkError, TimeoutError):
|
|
17
|
+
"""TimeoutError indicates that a request timed out"""
|
|
18
|
+
|
|
19
|
+
|
|
12
20
|
class AuthenticationError(IOError):
|
|
13
21
|
"""AuthenticationError indicates that a server request failed due to a missing or invalid authentication token"""
|
|
14
22
|
|
|
@@ -60,20 +68,42 @@ class AnyRpcError(Protocol):
|
|
|
60
68
|
def details(self) -> str: ...
|
|
61
69
|
|
|
62
70
|
|
|
63
|
-
def translate_rpc_error(err: AnyRpcError) ->
|
|
71
|
+
def translate_rpc_error(err: AnyRpcError) -> BaseException: # noqa: PLR0911, C901
|
|
64
72
|
# translate specific error codes to more pythonic errors
|
|
73
|
+
|
|
74
|
+
# https://grpc.io/docs/guides/error/
|
|
65
75
|
match err.code():
|
|
76
|
+
case StatusCode.NOT_FOUND:
|
|
77
|
+
return NotFoundError(err.details())
|
|
78
|
+
case StatusCode.INVALID_ARGUMENT:
|
|
79
|
+
return ArgumentError(err.details())
|
|
66
80
|
case StatusCode.UNAUTHENTICATED:
|
|
67
81
|
return AuthenticationError(f"Unauthenticated: {err.details()}")
|
|
68
82
|
case StatusCode.PERMISSION_DENIED:
|
|
69
83
|
return AuthenticationError(f"Unauthorized: {err.details()}")
|
|
70
|
-
case StatusCode.NOT_FOUND:
|
|
71
|
-
return NotFoundError(err.details())
|
|
72
84
|
case StatusCode.RESOURCE_EXHAUSTED:
|
|
73
85
|
return SubscriptionLimitExceededError(err.details())
|
|
74
|
-
case StatusCode.
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
case StatusCode.DEADLINE_EXCEEDED:
|
|
87
|
+
# Deadline expired before server returned status
|
|
88
|
+
return NetworkTimeoutError(f"Request timed out: {err.details()}")
|
|
89
|
+
case StatusCode.UNAVAILABLE:
|
|
90
|
+
# Server shutting down, or some data transmitted and then the connection broke
|
|
91
|
+
return NetworkError(err.details())
|
|
92
|
+
case StatusCode.ABORTED:
|
|
93
|
+
return NetworkError(f"Request aborted: {err.details()}")
|
|
94
|
+
case StatusCode.UNKNOWN:
|
|
95
|
+
# Server threw an exception (or did something other than returning a status code to terminate the RPC)
|
|
96
|
+
return InternalServerError(f"Oops, something went wrong: {err.details()}")
|
|
97
|
+
case StatusCode.INTERNAL:
|
|
98
|
+
return InternalServerError(f"Oops, something went wrong: {err.details()}")
|
|
99
|
+
case StatusCode.CANCELLED:
|
|
100
|
+
# Client application cancelled the request
|
|
101
|
+
return KeyboardInterrupt(f"Request canceled by user: {err.details()}")
|
|
102
|
+
case StatusCode.UNIMPLEMENTED:
|
|
103
|
+
# Method not found on server
|
|
104
|
+
return NotImplementedError(err.details())
|
|
105
|
+
|
|
106
|
+
# for all other errors we raise a generic internal server error
|
|
77
107
|
return InternalServerError(f"Oops, something went wrong: {err.details()}")
|
|
78
108
|
|
|
79
109
|
|
|
@@ -24,9 +24,9 @@ dependencies = [
|
|
|
24
24
|
# our version of the protobuf compiler generates code that requires grpcio 1.63.0 or higher
|
|
25
25
|
# grpcio 1.65.1 contains a bug that produces lots of logging noise: https://github.com/grpc/grpc/issues/37178
|
|
26
26
|
# grpcio 1.66 also has this bug on MacOS still: https://github.com/grpc/grpc/issues/37642
|
|
27
|
-
"grpcio>=1.
|
|
28
|
-
"grpcio-status>=1.
|
|
29
|
-
"protobuf>=
|
|
27
|
+
"grpcio>=1.70",
|
|
28
|
+
"grpcio-status>=1.70",
|
|
29
|
+
"protobuf>=6",
|
|
30
30
|
# for the libraries below we specify a minimum, tested to be working version
|
|
31
31
|
"lz4>=4",
|
|
32
32
|
"anyio>=4",
|
|
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
|