grpcio-fips 1.53.2__0-cp38-cp38-win_amd64.whl

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.
Files changed (62) hide show
  1. grpc/__init__.py +2174 -0
  2. grpc/_auth.py +68 -0
  3. grpc/_channel.py +1767 -0
  4. grpc/_common.py +177 -0
  5. grpc/_compression.py +63 -0
  6. grpc/_cython/__init__.py +13 -0
  7. grpc/_cython/_credentials/roots.pem +4337 -0
  8. grpc/_cython/_cygrpc/__init__.py +13 -0
  9. grpc/_cython/cygrpc.cp38-win_amd64.pyd +0 -0
  10. grpc/_grpcio_metadata.py +1 -0
  11. grpc/_interceptor.py +638 -0
  12. grpc/_plugin_wrapping.py +121 -0
  13. grpc/_runtime_protos.py +159 -0
  14. grpc/_server.py +1141 -0
  15. grpc/_simple_stubs.py +486 -0
  16. grpc/_typing.py +58 -0
  17. grpc/_utilities.py +180 -0
  18. grpc/aio/__init__.py +95 -0
  19. grpc/aio/_base_call.py +248 -0
  20. grpc/aio/_base_channel.py +348 -0
  21. grpc/aio/_base_server.py +369 -0
  22. grpc/aio/_call.py +649 -0
  23. grpc/aio/_channel.py +492 -0
  24. grpc/aio/_interceptor.py +1003 -0
  25. grpc/aio/_metadata.py +120 -0
  26. grpc/aio/_server.py +209 -0
  27. grpc/aio/_typing.py +35 -0
  28. grpc/aio/_utils.py +22 -0
  29. grpc/beta/__init__.py +13 -0
  30. grpc/beta/_client_adaptations.py +706 -0
  31. grpc/beta/_metadata.py +52 -0
  32. grpc/beta/_server_adaptations.py +385 -0
  33. grpc/beta/implementations.py +311 -0
  34. grpc/beta/interfaces.py +163 -0
  35. grpc/beta/utilities.py +149 -0
  36. grpc/experimental/__init__.py +128 -0
  37. grpc/experimental/aio/__init__.py +16 -0
  38. grpc/experimental/gevent.py +27 -0
  39. grpc/experimental/session_cache.py +45 -0
  40. grpc/framework/__init__.py +13 -0
  41. grpc/framework/common/__init__.py +13 -0
  42. grpc/framework/common/cardinality.py +26 -0
  43. grpc/framework/common/style.py +24 -0
  44. grpc/framework/foundation/__init__.py +13 -0
  45. grpc/framework/foundation/abandonment.py +22 -0
  46. grpc/framework/foundation/callable_util.py +94 -0
  47. grpc/framework/foundation/future.py +219 -0
  48. grpc/framework/foundation/logging_pool.py +71 -0
  49. grpc/framework/foundation/stream.py +43 -0
  50. grpc/framework/foundation/stream_util.py +148 -0
  51. grpc/framework/interfaces/__init__.py +13 -0
  52. grpc/framework/interfaces/base/__init__.py +13 -0
  53. grpc/framework/interfaces/base/base.py +325 -0
  54. grpc/framework/interfaces/base/utilities.py +71 -0
  55. grpc/framework/interfaces/face/__init__.py +13 -0
  56. grpc/framework/interfaces/face/face.py +1049 -0
  57. grpc/framework/interfaces/face/utilities.py +168 -0
  58. grpcio_fips-1.53.2.dist-info/LICENSE +610 -0
  59. grpcio_fips-1.53.2.dist-info/METADATA +139 -0
  60. grpcio_fips-1.53.2.dist-info/RECORD +62 -0
  61. grpcio_fips-1.53.2.dist-info/WHEEL +5 -0
  62. grpcio_fips-1.53.2.dist-info/top_level.txt +1 -0
grpc/_auth.py ADDED
@@ -0,0 +1,68 @@
1
+ # Copyright 2016 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """GRPCAuthMetadataPlugins for standard authentication."""
15
+
16
+ import inspect
17
+ from typing import Any, Optional
18
+
19
+ import grpc
20
+
21
+
22
+ def _sign_request(callback: grpc.AuthMetadataPluginCallback,
23
+ token: Optional[str], error: Optional[Exception]):
24
+ metadata = (('authorization', 'Bearer {}'.format(token)),)
25
+ callback(metadata, error)
26
+
27
+
28
+ class GoogleCallCredentials(grpc.AuthMetadataPlugin):
29
+ """Metadata wrapper for GoogleCredentials from the oauth2client library."""
30
+ _is_jwt: bool
31
+ _credentials: Any
32
+
33
+ # TODO(xuanwn): Give credentials an actual type.
34
+ def __init__(self, credentials: Any):
35
+ self._credentials = credentials
36
+ # Hack to determine if these are JWT creds and we need to pass
37
+ # additional_claims when getting a token
38
+ self._is_jwt = 'additional_claims' in inspect.getfullargspec(
39
+ credentials.get_access_token).args
40
+
41
+ def __call__(self, context: grpc.AuthMetadataContext,
42
+ callback: grpc.AuthMetadataPluginCallback):
43
+ try:
44
+ if self._is_jwt:
45
+ access_token = self._credentials.get_access_token(
46
+ additional_claims={
47
+ 'aud':
48
+ context.
49
+ service_url # pytype: disable=attribute-error
50
+ }).access_token
51
+ else:
52
+ access_token = self._credentials.get_access_token().access_token
53
+ except Exception as exception: # pylint: disable=broad-except
54
+ _sign_request(callback, None, exception)
55
+ else:
56
+ _sign_request(callback, access_token, None)
57
+
58
+
59
+ class AccessTokenAuthMetadataPlugin(grpc.AuthMetadataPlugin):
60
+ """Metadata wrapper for raw access token credentials."""
61
+ _access_token: str
62
+
63
+ def __init__(self, access_token: str):
64
+ self._access_token = access_token
65
+
66
+ def __call__(self, context: grpc.AuthMetadataContext,
67
+ callback: grpc.AuthMetadataPluginCallback):
68
+ _sign_request(callback, self._access_token, None)