gnetclisdk 1.0.1__py3-none-any.whl → 1.0.32__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
gnetclisdk/client.py CHANGED
@@ -59,7 +59,19 @@ class File:
59
59
  class HostParams:
60
60
  device: str
61
61
  port: Optional[int] = None
62
+ hostname: Optional[str] = None
62
63
  credentials: Optional[Credentials] = None
64
+ ip: Optional[str] = None
65
+
66
+ def make_pb(self) -> Message:
67
+ pbcmd = server_pb2.HostParams(
68
+ host=self.hostname,
69
+ port=self.port,
70
+ credentials=self.credentials.make_pb(),
71
+ device=self.device,
72
+ ip=self.ip,
73
+ )
74
+ return pbcmd
63
75
 
64
76
 
65
77
  def make_auth(auth_token: str) -> ClientAuthentication:
@@ -119,6 +131,7 @@ class Gnetcli:
119
131
  qa: Optional[List[QA]] = None,
120
132
  read_timeout: float = 0.0,
121
133
  cmd_timeout: float = 0.0,
134
+ host_params: Optional[HostParams] = None,
122
135
  ) -> Message:
123
136
  pbcmd = make_cmd(
124
137
  hostname=hostname,
@@ -127,6 +140,7 @@ class Gnetcli:
127
140
  qa=qa,
128
141
  read_timeout=read_timeout,
129
142
  cmd_timeout=cmd_timeout,
143
+ host_params=host_params,
130
144
  )
131
145
  if self._channel is None:
132
146
  _logger.debug("connect to %s", self._server)
@@ -342,6 +356,7 @@ class GnetcliSessionCmd(GnetcliSession):
342
356
  qa: Optional[List[QA]] = None,
343
357
  cmd_timeout: float = 0.0,
344
358
  read_timeout: float = 0.0,
359
+ host_params: Optional[HostParams] = None,
345
360
  ) -> Message:
346
361
  _logger.debug("session cmd %r", cmd)
347
362
  pbcmd = make_cmd(
@@ -351,6 +366,7 @@ class GnetcliSessionCmd(GnetcliSession):
351
366
  qa=qa,
352
367
  read_timeout=read_timeout,
353
368
  cmd_timeout=cmd_timeout,
369
+ host_params=host_params,
354
370
  )
355
371
  return await self._cmd(pbcmd)
356
372
 
@@ -437,6 +453,7 @@ def make_cmd(
437
453
  qa: Optional[List[QA]] = None,
438
454
  read_timeout: float = 0.0,
439
455
  cmd_timeout: float = 0.0,
456
+ host_params: Optional[HostParams] = None,
440
457
  ) -> Message:
441
458
  qa_cmd: List[Message] = []
442
459
  if qa:
@@ -452,6 +469,7 @@ def make_cmd(
452
469
  qa=qa_cmd,
453
470
  read_timeout=read_timeout,
454
471
  cmd_timeout=cmd_timeout,
472
+ host_params=host_params.make_pb(),
455
473
  )
456
474
  return res # type: ignore
457
475
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gnetclisdk
3
- Version: 1.0.1
3
+ Version: 1.0.32
4
4
  Summary: Client for Gnetcli GRPC-server
5
5
  Home-page: https://github.com/annetutil/gnetcli
6
6
  Author: Alexander Balezin
@@ -1,11 +1,11 @@
1
1
  gnetclisdk/auth.py,sha256=GwM7H7Ecb-gwqUTkQorifNB_mtnZfgeS46gOW2Vx1U4,1246
2
- gnetclisdk/client.py,sha256=5C3bU47B8MMcb40I3OSY5abN0pKR4oGyUXqkrV0JyKY,16717
2
+ gnetclisdk/client.py,sha256=NvhxhxZ3YCVLnAslKao_YnnLWOWV76hx8v8_jUSNQsM,17317
3
3
  gnetclisdk/exceptions.py,sha256=d0Bcq8tnAzemCuCCrGJEmL_A1IQxCCLFRCwDhr9zvkU,2683
4
4
  gnetclisdk/interceptors.py,sha256=apj3l4lnR2ZcsA49odptrBC0kTDmP6Mp0EzYkeEJz9Y,7010
5
5
  gnetclisdk/proto/server_pb2.py,sha256=YL1_7wubJbSp97OeRZ_L9qJjbM2U-PMcfOg-_QpkjWs,8360
6
6
  gnetclisdk/proto/server_pb2.pyi,sha256=th-HnFVkR1ZEY-XmFmk8VMfDj_4uFAoSAXH61mSlVec,8295
7
7
  gnetclisdk/proto/server_pb2_grpc.py,sha256=rjuNEIfeqwFw99oSiWUyvNKCKPgITJZKcL8pQPbUQvM,14967
8
- gnetclisdk-1.0.1.dist-info/METADATA,sha256=5G7SZFznhrosYbq8Qn1XutLVT6rOGxL4hZJjm-Mr5Q8,1433
9
- gnetclisdk-1.0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
10
- gnetclisdk-1.0.1.dist-info/top_level.txt,sha256=MNjS8LEt6d2rZ-dUbV2cnqkuTMu3EqEL2eiSvUZuUlA,11
11
- gnetclisdk-1.0.1.dist-info/RECORD,,
8
+ gnetclisdk-1.0.32.dist-info/METADATA,sha256=bDoDGZwCUV7FVUknwhp4_QQdkLle_X6zzUTz2uaJlLo,1434
9
+ gnetclisdk-1.0.32.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
10
+ gnetclisdk-1.0.32.dist-info/top_level.txt,sha256=MNjS8LEt6d2rZ-dUbV2cnqkuTMu3EqEL2eiSvUZuUlA,11
11
+ gnetclisdk-1.0.32.dist-info/RECORD,,