gnetclisdk 1.0.57__tar.gz → 1.0.58__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/PKG-INFO +1 -1
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/client.py +24 -20
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk.egg-info/PKG-INFO +1 -1
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/MANIFEST.in +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/README.md +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/auth.py +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/exceptions.py +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/interceptors.py +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/proto/server_pb2.py +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/proto/server_pb2.pyi +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk/proto/server_pb2_grpc.py +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk.egg-info/SOURCES.txt +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk.egg-info/dependency_links.txt +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk.egg-info/requires.txt +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/gnetclisdk.egg-info/top_level.txt +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/pyproject.toml +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/requirements.txt +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/setup.cfg +0 -0
- {gnetclisdk-1.0.57 → gnetclisdk-1.0.58}/setup.py +0 -0
@@ -7,7 +7,7 @@ from abc import ABC, abstractmethod
|
|
7
7
|
from contextlib import asynccontextmanager
|
8
8
|
from dataclasses import dataclass, field
|
9
9
|
from functools import partial
|
10
|
-
from typing import Any, AsyncIterator, List, Optional, Tuple, Dict
|
10
|
+
from typing import Any, AsyncIterator, List, Optional, Tuple, Dict, Callable
|
11
11
|
|
12
12
|
import grpc
|
13
13
|
from google.protobuf.message import Message
|
@@ -207,7 +207,7 @@ class Gnetcli:
|
|
207
207
|
channel=self._channel,
|
208
208
|
target_name_override=self._target_name_override,
|
209
209
|
user_agent=self._user_agent,
|
210
|
-
|
210
|
+
_grpc_channel_fn=self._grpc_channel_fn,
|
211
211
|
)
|
212
212
|
await sess.connect()
|
213
213
|
try:
|
@@ -286,6 +286,7 @@ class GnetcliSession(ABC):
|
|
286
286
|
insecure_grpc: bool = False,
|
287
287
|
channel: Optional[grpc.aio.Channel] = None,
|
288
288
|
credentials: Optional[Credentials] = None,
|
289
|
+
_grpc_channel_fn: Optional[Callable] = None,
|
289
290
|
):
|
290
291
|
self._hostname = hostname
|
291
292
|
self._credentials = credentials
|
@@ -300,25 +301,28 @@ class GnetcliSession(ABC):
|
|
300
301
|
("grpc.max_send_message_length", GRPC_MAX_MESSAGE_LENGTH),
|
301
302
|
("grpc.max_receive_message_length", GRPC_MAX_MESSAGE_LENGTH),
|
302
303
|
]
|
303
|
-
if
|
304
|
-
|
305
|
-
cert = get_cert(cert_file=cert_file)
|
306
|
-
channel_credentials = grpc.ssl_channel_credentials(root_certificates=cert)
|
307
|
-
authentication: ClientAuthentication
|
308
|
-
interceptors: [grpc.aio.ClientInterceptor] = list()
|
309
|
-
if not token:
|
310
|
-
pass
|
311
|
-
elif token.startswith("OAuth"):
|
312
|
-
authentication = OAuthClientAuthentication(token.split(" ")[1])
|
313
|
-
interceptors.append(get_auth_client_interceptors(authentication))
|
314
|
-
elif token.startswith("Basic"):
|
315
|
-
authentication = BasicClientAuthentication(token.split(" ")[1])
|
316
|
-
interceptors.append(get_auth_client_interceptors(authentication))
|
304
|
+
if _grpc_channel_fn:
|
305
|
+
grpc_channel_fn = _grpc_channel_fn
|
317
306
|
else:
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
307
|
+
if target_name_override:
|
308
|
+
options.append(("grpc.ssl_target_name_override", target_name_override))
|
309
|
+
cert = get_cert(cert_file=cert_file)
|
310
|
+
channel_credentials = grpc.ssl_channel_credentials(root_certificates=cert)
|
311
|
+
authentication: ClientAuthentication
|
312
|
+
interceptors: list[grpc.aio.ClientInterceptor] = list()
|
313
|
+
if not token:
|
314
|
+
pass
|
315
|
+
elif token.startswith("OAuth"):
|
316
|
+
authentication = OAuthClientAuthentication(token.split(" ")[1])
|
317
|
+
interceptors.append(get_auth_client_interceptors(authentication))
|
318
|
+
elif token.startswith("Basic"):
|
319
|
+
authentication = BasicClientAuthentication(token.split(" ")[1])
|
320
|
+
interceptors.append(get_auth_client_interceptors(authentication))
|
321
|
+
else:
|
322
|
+
raise Exception("unknown token type")
|
323
|
+
grpc_channel_fn = partial(grpc.aio.secure_channel, credentials=channel_credentials, interceptors=interceptors)
|
324
|
+
if insecure_grpc:
|
325
|
+
grpc_channel_fn = partial(grpc.aio.insecure_channel, interceptors=interceptors)
|
322
326
|
self._grpc_channel_fn = grpc_channel_fn
|
323
327
|
self._options = options
|
324
328
|
self._req_id: Optional[Any] = None
|
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
|