gnetclisdk 0.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,399 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
7
+ from . import server_pb2 as server__pb2
8
+
9
+ GRPC_GENERATED_VERSION = '1.66.1'
10
+ GRPC_VERSION = grpc.__version__
11
+ _version_not_supported = False
12
+
13
+ try:
14
+ from grpc._utilities import first_version_is_lower
15
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
16
+ except ImportError:
17
+ _version_not_supported = True
18
+
19
+ if _version_not_supported:
20
+ raise RuntimeError(
21
+ f'The grpc package installed is at version {GRPC_VERSION},'
22
+ + f' but the generated code in server_pb2_grpc.py depends on'
23
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
24
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
25
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
26
+ )
27
+
28
+
29
+ class GnetcliStub(object):
30
+ """Missing associated documentation comment in .proto file."""
31
+
32
+ def __init__(self, channel):
33
+ """Constructor.
34
+
35
+ Args:
36
+ channel: A grpc.Channel.
37
+ """
38
+ self.SetupHostParams = channel.unary_unary(
39
+ '/gnetcli.Gnetcli/SetupHostParams',
40
+ request_serializer=server__pb2.HostParams.SerializeToString,
41
+ response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
42
+ _registered_method=True)
43
+ self.Exec = channel.unary_unary(
44
+ '/gnetcli.Gnetcli/Exec',
45
+ request_serializer=server__pb2.CMD.SerializeToString,
46
+ response_deserializer=server__pb2.CMDResult.FromString,
47
+ _registered_method=True)
48
+ self.ExecChat = channel.stream_stream(
49
+ '/gnetcli.Gnetcli/ExecChat',
50
+ request_serializer=server__pb2.CMD.SerializeToString,
51
+ response_deserializer=server__pb2.CMDResult.FromString,
52
+ _registered_method=True)
53
+ self.AddDevice = channel.unary_unary(
54
+ '/gnetcli.Gnetcli/AddDevice',
55
+ request_serializer=server__pb2.Device.SerializeToString,
56
+ response_deserializer=server__pb2.DeviceResult.FromString,
57
+ _registered_method=True)
58
+ self.ExecNetconf = channel.unary_unary(
59
+ '/gnetcli.Gnetcli/ExecNetconf',
60
+ request_serializer=server__pb2.CMDNetconf.SerializeToString,
61
+ response_deserializer=server__pb2.CMDResult.FromString,
62
+ _registered_method=True)
63
+ self.ExecNetconfChat = channel.stream_stream(
64
+ '/gnetcli.Gnetcli/ExecNetconfChat',
65
+ request_serializer=server__pb2.CMDNetconf.SerializeToString,
66
+ response_deserializer=server__pb2.CMDResult.FromString,
67
+ _registered_method=True)
68
+ self.Download = channel.unary_unary(
69
+ '/gnetcli.Gnetcli/Download',
70
+ request_serializer=server__pb2.FileDownloadRequest.SerializeToString,
71
+ response_deserializer=server__pb2.FilesResult.FromString,
72
+ _registered_method=True)
73
+ self.Upload = channel.unary_unary(
74
+ '/gnetcli.Gnetcli/Upload',
75
+ request_serializer=server__pb2.FileUploadRequest.SerializeToString,
76
+ response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
77
+ _registered_method=True)
78
+
79
+
80
+ class GnetcliServicer(object):
81
+ """Missing associated documentation comment in .proto file."""
82
+
83
+ def SetupHostParams(self, request, context):
84
+ """Missing associated documentation comment in .proto file."""
85
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
86
+ context.set_details('Method not implemented!')
87
+ raise NotImplementedError('Method not implemented!')
88
+
89
+ def Exec(self, request, context):
90
+ """Missing associated documentation comment in .proto file."""
91
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
92
+ context.set_details('Method not implemented!')
93
+ raise NotImplementedError('Method not implemented!')
94
+
95
+ def ExecChat(self, request_iterator, context):
96
+ """Missing associated documentation comment in .proto file."""
97
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
98
+ context.set_details('Method not implemented!')
99
+ raise NotImplementedError('Method not implemented!')
100
+
101
+ def AddDevice(self, request, context):
102
+ """Missing associated documentation comment in .proto file."""
103
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
104
+ context.set_details('Method not implemented!')
105
+ raise NotImplementedError('Method not implemented!')
106
+
107
+ def ExecNetconf(self, request, context):
108
+ """Missing associated documentation comment in .proto file."""
109
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
110
+ context.set_details('Method not implemented!')
111
+ raise NotImplementedError('Method not implemented!')
112
+
113
+ def ExecNetconfChat(self, request_iterator, context):
114
+ """Missing associated documentation comment in .proto file."""
115
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
116
+ context.set_details('Method not implemented!')
117
+ raise NotImplementedError('Method not implemented!')
118
+
119
+ def Download(self, request, context):
120
+ """Missing associated documentation comment in .proto file."""
121
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
122
+ context.set_details('Method not implemented!')
123
+ raise NotImplementedError('Method not implemented!')
124
+
125
+ def Upload(self, request, context):
126
+ """Missing associated documentation comment in .proto file."""
127
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
128
+ context.set_details('Method not implemented!')
129
+ raise NotImplementedError('Method not implemented!')
130
+
131
+
132
+ def add_GnetcliServicer_to_server(servicer, server):
133
+ rpc_method_handlers = {
134
+ 'SetupHostParams': grpc.unary_unary_rpc_method_handler(
135
+ servicer.SetupHostParams,
136
+ request_deserializer=server__pb2.HostParams.FromString,
137
+ response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
138
+ ),
139
+ 'Exec': grpc.unary_unary_rpc_method_handler(
140
+ servicer.Exec,
141
+ request_deserializer=server__pb2.CMD.FromString,
142
+ response_serializer=server__pb2.CMDResult.SerializeToString,
143
+ ),
144
+ 'ExecChat': grpc.stream_stream_rpc_method_handler(
145
+ servicer.ExecChat,
146
+ request_deserializer=server__pb2.CMD.FromString,
147
+ response_serializer=server__pb2.CMDResult.SerializeToString,
148
+ ),
149
+ 'AddDevice': grpc.unary_unary_rpc_method_handler(
150
+ servicer.AddDevice,
151
+ request_deserializer=server__pb2.Device.FromString,
152
+ response_serializer=server__pb2.DeviceResult.SerializeToString,
153
+ ),
154
+ 'ExecNetconf': grpc.unary_unary_rpc_method_handler(
155
+ servicer.ExecNetconf,
156
+ request_deserializer=server__pb2.CMDNetconf.FromString,
157
+ response_serializer=server__pb2.CMDResult.SerializeToString,
158
+ ),
159
+ 'ExecNetconfChat': grpc.stream_stream_rpc_method_handler(
160
+ servicer.ExecNetconfChat,
161
+ request_deserializer=server__pb2.CMDNetconf.FromString,
162
+ response_serializer=server__pb2.CMDResult.SerializeToString,
163
+ ),
164
+ 'Download': grpc.unary_unary_rpc_method_handler(
165
+ servicer.Download,
166
+ request_deserializer=server__pb2.FileDownloadRequest.FromString,
167
+ response_serializer=server__pb2.FilesResult.SerializeToString,
168
+ ),
169
+ 'Upload': grpc.unary_unary_rpc_method_handler(
170
+ servicer.Upload,
171
+ request_deserializer=server__pb2.FileUploadRequest.FromString,
172
+ response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
173
+ ),
174
+ }
175
+ generic_handler = grpc.method_handlers_generic_handler(
176
+ 'gnetcli.Gnetcli', rpc_method_handlers)
177
+ server.add_generic_rpc_handlers((generic_handler,))
178
+ server.add_registered_method_handlers('gnetcli.Gnetcli', rpc_method_handlers)
179
+
180
+
181
+ # This class is part of an EXPERIMENTAL API.
182
+ class Gnetcli(object):
183
+ """Missing associated documentation comment in .proto file."""
184
+
185
+ @staticmethod
186
+ def SetupHostParams(request,
187
+ target,
188
+ options=(),
189
+ channel_credentials=None,
190
+ call_credentials=None,
191
+ insecure=False,
192
+ compression=None,
193
+ wait_for_ready=None,
194
+ timeout=None,
195
+ metadata=None):
196
+ return grpc.experimental.unary_unary(
197
+ request,
198
+ target,
199
+ '/gnetcli.Gnetcli/SetupHostParams',
200
+ server__pb2.HostParams.SerializeToString,
201
+ google_dot_protobuf_dot_empty__pb2.Empty.FromString,
202
+ options,
203
+ channel_credentials,
204
+ insecure,
205
+ call_credentials,
206
+ compression,
207
+ wait_for_ready,
208
+ timeout,
209
+ metadata,
210
+ _registered_method=True)
211
+
212
+ @staticmethod
213
+ def Exec(request,
214
+ target,
215
+ options=(),
216
+ channel_credentials=None,
217
+ call_credentials=None,
218
+ insecure=False,
219
+ compression=None,
220
+ wait_for_ready=None,
221
+ timeout=None,
222
+ metadata=None):
223
+ return grpc.experimental.unary_unary(
224
+ request,
225
+ target,
226
+ '/gnetcli.Gnetcli/Exec',
227
+ server__pb2.CMD.SerializeToString,
228
+ server__pb2.CMDResult.FromString,
229
+ options,
230
+ channel_credentials,
231
+ insecure,
232
+ call_credentials,
233
+ compression,
234
+ wait_for_ready,
235
+ timeout,
236
+ metadata,
237
+ _registered_method=True)
238
+
239
+ @staticmethod
240
+ def ExecChat(request_iterator,
241
+ target,
242
+ options=(),
243
+ channel_credentials=None,
244
+ call_credentials=None,
245
+ insecure=False,
246
+ compression=None,
247
+ wait_for_ready=None,
248
+ timeout=None,
249
+ metadata=None):
250
+ return grpc.experimental.stream_stream(
251
+ request_iterator,
252
+ target,
253
+ '/gnetcli.Gnetcli/ExecChat',
254
+ server__pb2.CMD.SerializeToString,
255
+ server__pb2.CMDResult.FromString,
256
+ options,
257
+ channel_credentials,
258
+ insecure,
259
+ call_credentials,
260
+ compression,
261
+ wait_for_ready,
262
+ timeout,
263
+ metadata,
264
+ _registered_method=True)
265
+
266
+ @staticmethod
267
+ def AddDevice(request,
268
+ target,
269
+ options=(),
270
+ channel_credentials=None,
271
+ call_credentials=None,
272
+ insecure=False,
273
+ compression=None,
274
+ wait_for_ready=None,
275
+ timeout=None,
276
+ metadata=None):
277
+ return grpc.experimental.unary_unary(
278
+ request,
279
+ target,
280
+ '/gnetcli.Gnetcli/AddDevice',
281
+ server__pb2.Device.SerializeToString,
282
+ server__pb2.DeviceResult.FromString,
283
+ options,
284
+ channel_credentials,
285
+ insecure,
286
+ call_credentials,
287
+ compression,
288
+ wait_for_ready,
289
+ timeout,
290
+ metadata,
291
+ _registered_method=True)
292
+
293
+ @staticmethod
294
+ def ExecNetconf(request,
295
+ target,
296
+ options=(),
297
+ channel_credentials=None,
298
+ call_credentials=None,
299
+ insecure=False,
300
+ compression=None,
301
+ wait_for_ready=None,
302
+ timeout=None,
303
+ metadata=None):
304
+ return grpc.experimental.unary_unary(
305
+ request,
306
+ target,
307
+ '/gnetcli.Gnetcli/ExecNetconf',
308
+ server__pb2.CMDNetconf.SerializeToString,
309
+ server__pb2.CMDResult.FromString,
310
+ options,
311
+ channel_credentials,
312
+ insecure,
313
+ call_credentials,
314
+ compression,
315
+ wait_for_ready,
316
+ timeout,
317
+ metadata,
318
+ _registered_method=True)
319
+
320
+ @staticmethod
321
+ def ExecNetconfChat(request_iterator,
322
+ target,
323
+ options=(),
324
+ channel_credentials=None,
325
+ call_credentials=None,
326
+ insecure=False,
327
+ compression=None,
328
+ wait_for_ready=None,
329
+ timeout=None,
330
+ metadata=None):
331
+ return grpc.experimental.stream_stream(
332
+ request_iterator,
333
+ target,
334
+ '/gnetcli.Gnetcli/ExecNetconfChat',
335
+ server__pb2.CMDNetconf.SerializeToString,
336
+ server__pb2.CMDResult.FromString,
337
+ options,
338
+ channel_credentials,
339
+ insecure,
340
+ call_credentials,
341
+ compression,
342
+ wait_for_ready,
343
+ timeout,
344
+ metadata,
345
+ _registered_method=True)
346
+
347
+ @staticmethod
348
+ def Download(request,
349
+ target,
350
+ options=(),
351
+ channel_credentials=None,
352
+ call_credentials=None,
353
+ insecure=False,
354
+ compression=None,
355
+ wait_for_ready=None,
356
+ timeout=None,
357
+ metadata=None):
358
+ return grpc.experimental.unary_unary(
359
+ request,
360
+ target,
361
+ '/gnetcli.Gnetcli/Download',
362
+ server__pb2.FileDownloadRequest.SerializeToString,
363
+ server__pb2.FilesResult.FromString,
364
+ options,
365
+ channel_credentials,
366
+ insecure,
367
+ call_credentials,
368
+ compression,
369
+ wait_for_ready,
370
+ timeout,
371
+ metadata,
372
+ _registered_method=True)
373
+
374
+ @staticmethod
375
+ def Upload(request,
376
+ target,
377
+ options=(),
378
+ channel_credentials=None,
379
+ call_credentials=None,
380
+ insecure=False,
381
+ compression=None,
382
+ wait_for_ready=None,
383
+ timeout=None,
384
+ metadata=None):
385
+ return grpc.experimental.unary_unary(
386
+ request,
387
+ target,
388
+ '/gnetcli.Gnetcli/Upload',
389
+ server__pb2.FileUploadRequest.SerializeToString,
390
+ google_dot_protobuf_dot_empty__pb2.Empty.FromString,
391
+ options,
392
+ channel_credentials,
393
+ insecure,
394
+ call_credentials,
395
+ compression,
396
+ wait_for_ready,
397
+ timeout,
398
+ metadata,
399
+ _registered_method=True)
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.1
2
+ Name: gnetclisdk
3
+ Version: 0.0
4
+ Summary: Client for Gnetcli GRPC-server
5
+ Home-page: https://github.com/annetutil/gnetcli
6
+ Author: Alexander Balezin
7
+ Author-email: gescheit12@gmail.com
8
+ License: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: protobuf ==4.24.4
17
+ Requires-Dist: grpcio ==1.59.2
18
+ Requires-Dist: googleapis-common-protos ==1.61.0
19
+
20
+ ## Python client for Gnetcli GRPC server
21
+
22
+ Gnetcli provides a universal way to execute arbitrary commands using a CLI,
23
+ eliminating the need for screen scraping with expect.
24
+
25
+ See documentation on [gnetcli server](https://annetutil.github.io/gnetcli/).
26
+
27
+ Example:
28
+
29
+ ```python
30
+ from gnetclisdk.client import Credentials, Gnetcli
31
+ import os, asyncio
32
+
33
+ async def example():
34
+ api = Gnetcli(insecure_grpc=True)
35
+ dev_creds = Credentials(os.environ.get("LOGIN"), os.environ.get("PASSWORD"))
36
+ res = await api.cmd(hostname="myhost", device="huawei", cmd="dis clock", credentials=dev_creds)
37
+ print("err=%s status=%s out=%s" % (res.error, res.status, res.out))
38
+
39
+ asyncio.run(example())
40
+ ```
41
+
42
+ Output:
43
+ ```
44
+ err=b'' status=0 out=b'2023-11-10 09:31:58\nFriday\nTime Zone(UTC) : UTC'
45
+ ```
@@ -0,0 +1,11 @@
1
+ gnetclisdk/auth.py,sha256=GwM7H7Ecb-gwqUTkQorifNB_mtnZfgeS46gOW2Vx1U4,1246
2
+ gnetclisdk/client.py,sha256=NvhxhxZ3YCVLnAslKao_YnnLWOWV76hx8v8_jUSNQsM,17317
3
+ gnetclisdk/exceptions.py,sha256=d0Bcq8tnAzemCuCCrGJEmL_A1IQxCCLFRCwDhr9zvkU,2683
4
+ gnetclisdk/interceptors.py,sha256=apj3l4lnR2ZcsA49odptrBC0kTDmP6Mp0EzYkeEJz9Y,7010
5
+ gnetclisdk/proto/server_pb2.py,sha256=YL1_7wubJbSp97OeRZ_L9qJjbM2U-PMcfOg-_QpkjWs,8360
6
+ gnetclisdk/proto/server_pb2.pyi,sha256=th-HnFVkR1ZEY-XmFmk8VMfDj_4uFAoSAXH61mSlVec,8295
7
+ gnetclisdk/proto/server_pb2_grpc.py,sha256=rjuNEIfeqwFw99oSiWUyvNKCKPgITJZKcL8pQPbUQvM,14967
8
+ gnetclisdk-0.0.dist-info/METADATA,sha256=NZSdVwA36BQMobM-9EsRqFOBOFcyinTeO2siwf3Z3Cs,1431
9
+ gnetclisdk-0.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
10
+ gnetclisdk-0.0.dist-info/top_level.txt,sha256=MNjS8LEt6d2rZ-dUbV2cnqkuTMu3EqEL2eiSvUZuUlA,11
11
+ gnetclisdk-0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ gnetclisdk