nmcli 1.4.0__tar.gz → 1.6.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.
Files changed (43) hide show
  1. nmcli-1.6.0/LICENSE.txt +21 -0
  2. nmcli-1.6.0/PKG-INFO +582 -0
  3. {nmcli-1.4.0 → nmcli-1.6.0}/README.md +65 -57
  4. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_connection.py +9 -3
  5. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_device.py +4 -0
  6. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/_connection.py +7 -1
  7. nmcli-1.6.0/nmcli.egg-info/PKG-INFO +582 -0
  8. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli.egg-info/SOURCES.txt +10 -1
  9. nmcli-1.6.0/pyproject.toml +26 -0
  10. nmcli-1.6.0/setup.py +6 -0
  11. nmcli-1.6.0/tests/test_connection.py +139 -0
  12. nmcli-1.6.0/tests/test_device.py +345 -0
  13. nmcli-1.6.0/tests/test_general.py +39 -0
  14. nmcli-1.6.0/tests/test_helper.py +16 -0
  15. nmcli-1.6.0/tests/test_networking.py +51 -0
  16. nmcli-1.6.0/tests/test_radio.py +80 -0
  17. nmcli-1.6.0/tests/test_system.py +156 -0
  18. nmcli-1.4.0/PKG-INFO +0 -574
  19. nmcli-1.4.0/nmcli.egg-info/PKG-INFO +0 -574
  20. nmcli-1.4.0/setup.py +0 -39
  21. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/__init__.py +0 -0
  22. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_const.py +0 -0
  23. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_exception.py +0 -0
  24. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_general.py +0 -0
  25. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_helper.py +0 -0
  26. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_networking.py +0 -0
  27. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_radio.py +0 -0
  28. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/_system.py +0 -0
  29. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/__init__.py +0 -0
  30. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/connection.py +0 -0
  31. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/device.py +0 -0
  32. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/general.py +0 -0
  33. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/hotspot.py +0 -0
  34. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/data/radio.py +0 -0
  35. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/__init__.py +0 -0
  36. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/_device.py +0 -0
  37. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/_general.py +0 -0
  38. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/_networking.py +0 -0
  39. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/dummy/_radio.py +0 -0
  40. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli/py.typed +0 -0
  41. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli.egg-info/dependency_links.txt +0 -0
  42. {nmcli-1.4.0 → nmcli-1.6.0}/nmcli.egg-info/top_level.txt +0 -0
  43. {nmcli-1.4.0 → nmcli-1.6.0}/setup.cfg +0 -0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 ushiboy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
nmcli-1.6.0/PKG-INFO ADDED
@@ -0,0 +1,582 @@
1
+ Metadata-Version: 2.4
2
+ Name: nmcli
3
+ Version: 1.6.0
4
+ Summary: A python wrapper library for the network-manager cli client
5
+ Author: ushiboy
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ushiboy/nmcli
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.txt
13
+ Dynamic: license-file
14
+
15
+ # nmcli
16
+
17
+ nmcli is a python wrapper library for the network-manager cli client.
18
+
19
+ ## Quick Sample
20
+
21
+ Here is a simple usecase.
22
+
23
+ ```python
24
+ import nmcli
25
+
26
+ try:
27
+ print(nmcli.connection())
28
+ print(nmcli.device())
29
+ print(nmcli.device.wifi())
30
+ print(nmcli.general())
31
+
32
+ nmcli.device.wifi_connect('AP1', 'passphrase')
33
+ nmcli.connection.modify('AP1', {
34
+ 'ipv4.addresses': '192.168.1.1/24',
35
+ 'ipv4.gateway': '192.168.1.255',
36
+ 'ipv4.method': 'manual'
37
+ })
38
+ nmcli.connection.down('AP1')
39
+ nmcli.connection.up('AP1')
40
+ nmcli.connection.delete('AP1')
41
+ except Exception as e:
42
+ print(e)
43
+ ```
44
+
45
+ ## Dependency
46
+
47
+ - NetworkManager
48
+ - `sudo apt install network-manager` (Debian)
49
+ - User who can execute nmcli with sudo with NOPASSWD
50
+ - If sudo is not needed (like root user), use `disable_use_sudo` at the beginning of the process.
51
+
52
+ ## Compatibility table
53
+
54
+ | Object | Command | Status |
55
+ | ---------- | ------------ | ------------- |
56
+ | general | | supported |
57
+ | general | status | supported |
58
+ | general | hostname | supported |
59
+ | general | permissions | not supported |
60
+ | general | logging | not supported |
61
+ | networking | | supported |
62
+ | networking | on | supported |
63
+ | networking | off | supported |
64
+ | networking | connectivity | supported |
65
+ | radio | | supported |
66
+ | radio | all | supported |
67
+ | radio | wifi | supported |
68
+ | radio | wwan | supported |
69
+ | connection | | supported |
70
+ | connection | show | supported |
71
+ | connection | up | supported |
72
+ | connection | down | supported |
73
+ | connection | add | supported |
74
+ | connection | modify | supported |
75
+ | connection | clone | not supported |
76
+ | connection | edit | not supported |
77
+ | connection | delete | supported |
78
+ | connection | reload | supported |
79
+ | connection | load | not supported |
80
+ | connection | import | not supported |
81
+ | connection | export | not supported |
82
+ | device | | supported |
83
+ | device | status | supported |
84
+ | device | show | supported |
85
+ | device | set | not supported |
86
+ | device | connect | supported |
87
+ | device | reapply | supported |
88
+ | device | modify | not supported |
89
+ | device | disconnect | supported |
90
+ | device | delete | supported |
91
+ | device | monitor | not supported |
92
+ | device | wifi | supported |
93
+ | device | wifi connect | supported |
94
+ | device | wifi rescan | supported |
95
+ | device | wifi hotspot | supported |
96
+ | device | lldp | not supported |
97
+ | agent | | not supported |
98
+ | agent | secret | not supported |
99
+ | agent | polkit | not supported |
100
+ | agent | all | not supported |
101
+ | monitor | | not supported |
102
+
103
+ ## API
104
+
105
+ ### connection
106
+
107
+ #### nmcli.connection
108
+
109
+ Get a list of connections.
110
+
111
+ ```
112
+ nmcli.connection() -> List[Connection]
113
+ ```
114
+
115
+ #### nmcli.connection.add
116
+
117
+ Create a new connection using specified properties.
118
+
119
+ ```
120
+ nmcli.connection.add(
121
+ conn_type: str,
122
+ options: Optional[ConnectionOptions] = None,
123
+ ifname: str = "*",
124
+ name: str = None,
125
+ autoconnect: bool = None) -> None
126
+ ```
127
+
128
+ #### nmcli.connection.modify
129
+
130
+ Add, modify or remove properties in the connection profile.
131
+
132
+ ```
133
+ nmcli.connection.modify(name: str, options: ConnectionOptions) -> None
134
+ ```
135
+
136
+ #### nmcli.connection.delete
137
+
138
+ Delete a configured connection.
139
+
140
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
141
+
142
+ ```
143
+ nmcli.connection.delete(name: str, wait: int = None) -> None
144
+ ```
145
+
146
+ #### nmcli.connection.up
147
+
148
+ Activate a connection.
149
+
150
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
151
+
152
+ ```
153
+ nmcli.connection.up(name: str, wait: int = None) -> None
154
+ ```
155
+
156
+ #### nmcli.connection.down
157
+
158
+ Deactivate a connection from a device without preventing the device from further auto-activation.
159
+
160
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
161
+
162
+ ```
163
+ nmcli.connection.down(name: str, wait: int = None) -> None
164
+ ```
165
+
166
+ #### nmcli.connection.show
167
+
168
+ Show details for specified connections.
169
+
170
+ Use `show_secrets` argument to reveal associated secrets as well.
171
+ Use `active` argument to show only the active profile.
172
+
173
+ ```
174
+ nmcli.connection.show(name: str, show_secrets: bool = False, active: bool = False) -> ConnectionDetails
175
+ ```
176
+
177
+ #### nmcli.connection.reload
178
+
179
+ Reload all connection files from disk.
180
+
181
+ ```
182
+ nmcli.connection.reload() -> None
183
+ ```
184
+
185
+ ### device
186
+
187
+ #### nmcli.device
188
+
189
+ Print status of devices.
190
+
191
+ ```
192
+ nmcli.device() -> List[Device]
193
+ ```
194
+
195
+ #### nmcli.device.status
196
+
197
+ Show status for all devices.
198
+
199
+ ```
200
+ nmcli.device.status() -> List[Device]
201
+ ```
202
+
203
+ #### nmcli.device.show
204
+
205
+ Show details of device.
206
+
207
+ The `fields` argument applies the same effect to the command as the `-f | --fields` option. If it is omitted, the default behavior is followed.
208
+
209
+ ```
210
+ nmcli.device.show(ifname: str, fields: str = None) -> DeviceDetails
211
+ ```
212
+
213
+ #### nmcli.device.show_all
214
+
215
+ Show details of devices.
216
+
217
+ The `fields` argument applies the same effect to the command as the `-f | --fields` option. If it is omitted, the default behavior is followed.
218
+
219
+ ```
220
+ nmcli.device.show_all(fields: str = None) -> List[DeviceDetails]
221
+ ```
222
+
223
+ #### nmcli.device.connect
224
+
225
+ Connect the device.
226
+
227
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
228
+
229
+ ```
230
+ nmcli.device.connect(ifname: str, wait: int = None) -> None
231
+ ```
232
+
233
+ #### nmcli.device.disconnect
234
+
235
+ Disconnect devices.
236
+
237
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
238
+
239
+ ```
240
+ nmcli.device.disconnect(ifname: str, wait: int = None) -> None
241
+ ```
242
+
243
+ #### nmcli.device.reapply
244
+
245
+ Attempts to update device with changes to the currently active connection made since it was last applied.
246
+
247
+ ```
248
+ nmcli.device.reapply(ifname: str) -> None
249
+ ```
250
+
251
+ #### nmcli.device.delete
252
+
253
+ Delete the software devices.
254
+
255
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
256
+
257
+ ```
258
+ nmcli.device.delete(ifname: str, wait: int = None) -> None
259
+ ```
260
+
261
+ #### nmcli.device.wifi
262
+
263
+ List available Wi-Fi access points.
264
+
265
+ ```
266
+ nmcli.device.wifi(ifname: str = None, rescan: bool = None) -> List[DeviceWifi]
267
+ ```
268
+
269
+ #### nmcli.device.wifi_connect
270
+
271
+ Connect to a Wi-Fi network specified by SSID or BSSID.
272
+
273
+ The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
274
+
275
+ ```
276
+ nmcli.device.wifi_connect(ssid: str,
277
+ password: str,
278
+ ifname: str = None,
279
+ wait: int = None) -> None
280
+ ```
281
+
282
+ #### nmcli.device.wifi_hotspot
283
+
284
+ Create a Wi-Fi hotspot
285
+
286
+ ```
287
+ nmcli.device.wifi_hotspot(ifname: str = None,
288
+ con_name: str = None,
289
+ ssid: str = None,
290
+ band: str = None,
291
+ channel: int = None,
292
+ password: str = None) -> Hotspot
293
+ ```
294
+
295
+ #### nmcli.device.wifi_rescan
296
+
297
+ Request that NetworkManager immediately re-scan for available access points.
298
+
299
+ ```
300
+ nmcli.device.wifi_rescan(ifname: str = None, ssid: str = None) -> None
301
+ ```
302
+
303
+ ### general
304
+
305
+ #### nmcli.general
306
+
307
+ Show overall status of NetworkManager.
308
+
309
+ ```
310
+ nmcli.general() -> General
311
+ ```
312
+
313
+ #### nmcli.general.status
314
+
315
+ Show overall status of NetworkManager.
316
+
317
+ ```
318
+ nmcli.general.status() -> General
319
+ ```
320
+
321
+ #### nmcli.general.get_hostname
322
+
323
+ Get persistent system hostname.
324
+
325
+ ```
326
+ nmcli.general.get_hostname() -> str
327
+ ```
328
+
329
+ #### nmcli.general.set_hostname
330
+
331
+ Change persistent system hostname.
332
+
333
+ ```
334
+ nmcli.general.set_hostname(hostname: str) -> None
335
+ ```
336
+
337
+ ### networking
338
+
339
+ #### nmcli.networking
340
+
341
+ Get network connectivity state.
342
+
343
+ ```
344
+ nmcli.networking() -> NetworkConnectivity
345
+ ```
346
+
347
+ #### nmcli.networking.on
348
+
349
+ Switch networking on.
350
+
351
+ ```
352
+ nmcli.networking.on() -> None
353
+ ```
354
+
355
+ #### nmcli.networking.off
356
+
357
+ Switch networking off.
358
+
359
+ ```
360
+ nmcli.networking.off() -> None
361
+ ```
362
+
363
+ #### nmcli.networking.connectivity
364
+
365
+ Get network connectivity state.
366
+
367
+ The optional 'check' argument makes NetworkManager re-check the connectivity.
368
+
369
+ ```
370
+ nmcli.networking.connectivity(check:bool = False) -> NetworkConnectivity
371
+ ```
372
+
373
+ ### radio
374
+
375
+ #### nmcli.radio
376
+
377
+ Get status of all radio switches.
378
+
379
+ ```
380
+ nmcli.radio() -> Radio
381
+ ```
382
+
383
+ #### nmcli.radio.all
384
+
385
+ Get status of all radio switches.
386
+
387
+ ```
388
+ nmcli.radio.all() -> Radio
389
+ ```
390
+
391
+ #### nmcli.radio.all_on
392
+
393
+ Turn on all radio switches.
394
+
395
+ ```
396
+ nmcli.radio.all_on() -> None
397
+ ```
398
+
399
+ #### nmcli.radio.all_off
400
+
401
+ Turn off all radio switches.
402
+
403
+ ```
404
+ nmcli.radio.all_off() -> None
405
+ ```
406
+
407
+ #### nmcli.radio.wifi
408
+
409
+ Get status of Wi-Fi radio switch.
410
+
411
+ ```
412
+ nmcli.radio.wifi() -> bool
413
+ ```
414
+
415
+ #### nmcli.radio.wifi_on
416
+
417
+ Turn on Wi-Fi radio switches.
418
+
419
+ ```
420
+ nmcli.radio.wifi_on() -> None
421
+ ```
422
+
423
+ #### nmcli.radio.wifi_off
424
+
425
+ Turn off Wi-Fi radio switches.
426
+
427
+ ```
428
+ nmcli.radio.wifi_off() -> None
429
+ ```
430
+
431
+ #### nmcli.radio.wwan
432
+
433
+ Get status of mobile broadband radio switch.
434
+
435
+ ```
436
+ nmcli.radio.wwan() -> bool
437
+ ```
438
+
439
+ #### nmcli.radio.wwan_on
440
+
441
+ Turn on mobile broadband radio switches.
442
+
443
+ ```
444
+ nmcli.radio.wwan_on() -> None
445
+ ```
446
+
447
+ #### nmcli.radio.wwan_off
448
+
449
+ Turn off mobile broadband radio switches.
450
+
451
+ ```
452
+ nmcli.radio.wwan_off() -> None
453
+ ```
454
+
455
+ ### other
456
+
457
+ #### nmcli.disable_use_sudo
458
+
459
+ Disable the use of sudo.
460
+
461
+ ```
462
+ nmcli.disable_use_sudo() -> None
463
+ ```
464
+
465
+ #### nmcli.set_lang
466
+
467
+ Change the environment variable LANG from the default `C`.
468
+ Run this command when you want to use `C.UTF-8`.
469
+
470
+ ```
471
+ nmcli.set_lang(lang: str) -> None
472
+ ```
473
+
474
+ ## Change Log
475
+
476
+ ### 1.6.0
477
+
478
+ - Added active option to `nmcli.connection.show`
479
+
480
+ ### 1.5.0
481
+
482
+ - Added show_secrets option to `nmcli.connection.show`
483
+
484
+ ### 1.4.0
485
+
486
+ - Supported unsupported cases of `DeviceWifi.parse`.
487
+ - Fixed the problem that `nmcli.general` does not work on nmcli client after version 1.48.x.
488
+
489
+ ### 1.3.0
490
+
491
+ - Added rescan parameter to `nmcli.device.wifi`.
492
+
493
+ ### 1.2.0
494
+
495
+ - Added support for encodings other than UTF-8.
496
+
497
+ ### 1.1.2
498
+
499
+ - Fixed a problem with environment variables being scraped.
500
+
501
+ ### 1.1.1
502
+
503
+ - Include LICENSE.txt in the tar.
504
+
505
+ ### 1.1.0
506
+
507
+ - Added fields option to `nmcli.device.show` and `nmcli.device.show_all`
508
+
509
+ ### 1.0.0
510
+
511
+ - Handle connection failure exceptions with `nmcli.device.wifi_connect`.
512
+ - Added wait param to `nmcli.connection.delete`, `nmcli.connection.up`, `nmcli.connection.down`, `nmcli.device.connect`, `nmcli.device.disconnect`, `nmcli.device.delete`, `nmcli.device.wifi_connect`.
513
+
514
+ ### 0.9.0
515
+
516
+ - Added ifname param to wifi.
517
+
518
+ ### 0.8.0
519
+
520
+ - Added support for changing the LANG environment variable.
521
+
522
+ ### 0.7.0
523
+
524
+ - Added ifname param to wifi_connect.
525
+
526
+ ### 0.6.1
527
+
528
+ - Fixed a bug in the autoconnect parameter of the nmcli.connection.add method (made the default value conform to the specification of nmcli connection add).
529
+
530
+ ### 0.6.0
531
+
532
+ - Added BSSID and FREQ to DeviceWifi.
533
+
534
+ ### 0.5.0
535
+
536
+ - Added support for "nmcli device wifi hotspot".
537
+ - Added support for "nmcli device wifi rescan".
538
+
539
+ ### 0.4.2
540
+
541
+ - Fixed the parsing of device wifi.
542
+
543
+ ### 0.4.1
544
+
545
+ - Fixed parsing when SSID has a space.
546
+
547
+ ### 0.4.0
548
+
549
+ - Added disabling of sudo usage.
550
+ - Added support for parsing the execution results of recent versions of the nmcli device wifi command.
551
+
552
+ ### 0.3.1
553
+
554
+ - Fixed device status and device wifi parsing bug.
555
+
556
+ ### 0.3.0
557
+
558
+ - Added networking and radio APIs.
559
+ - Added more APIs for connection, device and general.
560
+ - Changed the properties of the General data class.
561
+ - Changed throw a ValueError exception if the regular expression pattern is not matched.
562
+
563
+ ### 0.2.2
564
+
565
+ - Fix the parsing bug of connection names that contain spaces (connection.show).
566
+ - Added getting items that begin with a capital letter.
567
+
568
+ ### 0.2.1
569
+
570
+ - Fix the parsing bug of connection names that contain spaces.
571
+
572
+ ### 0.2.0
573
+
574
+ - Added dummy classes.
575
+
576
+ ### 0.1.0
577
+
578
+ - Initial release.
579
+
580
+ ## License
581
+
582
+ MIT