nmcli 1.7.0__tar.gz → 1.8.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 (40) hide show
  1. {nmcli-1.7.0 → nmcli-1.8.0}/PKG-INFO +8 -2
  2. {nmcli-1.7.0 → nmcli-1.8.0}/README.md +7 -1
  3. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_device.py +6 -4
  4. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/_device.py +2 -2
  5. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli.egg-info/PKG-INFO +8 -2
  6. {nmcli-1.7.0 → nmcli-1.8.0}/pyproject.toml +1 -1
  7. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_device.py +21 -0
  8. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_general.py +2 -1
  9. {nmcli-1.7.0 → nmcli-1.8.0}/LICENSE.txt +0 -0
  10. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/__init__.py +0 -0
  11. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_connection.py +0 -0
  12. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_const.py +0 -0
  13. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_exception.py +0 -0
  14. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_general.py +0 -0
  15. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_helper.py +0 -0
  16. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_networking.py +0 -0
  17. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_radio.py +0 -0
  18. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/_system.py +0 -0
  19. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/__init__.py +0 -0
  20. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/connection.py +0 -0
  21. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/device.py +0 -0
  22. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/general.py +0 -0
  23. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/hotspot.py +0 -0
  24. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/data/radio.py +0 -0
  25. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/__init__.py +0 -0
  26. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/_connection.py +0 -0
  27. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/_general.py +0 -0
  28. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/_networking.py +0 -0
  29. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/dummy/_radio.py +0 -0
  30. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli/py.typed +0 -0
  31. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli.egg-info/SOURCES.txt +0 -0
  32. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli.egg-info/dependency_links.txt +0 -0
  33. {nmcli-1.7.0 → nmcli-1.8.0}/nmcli.egg-info/top_level.txt +0 -0
  34. {nmcli-1.7.0 → nmcli-1.8.0}/setup.cfg +0 -0
  35. {nmcli-1.7.0 → nmcli-1.8.0}/setup.py +0 -0
  36. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_connection.py +0 -0
  37. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_helper.py +0 -0
  38. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_networking.py +0 -0
  39. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_radio.py +0 -0
  40. {nmcli-1.7.0 → nmcli-1.8.0}/tests/test_system.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nmcli
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: A python wrapper library for the network-manager cli client
5
5
  Author: ushiboy
6
6
  License-Expression: MIT
@@ -307,9 +307,11 @@ Connect to a Wi-Fi network specified by SSID or BSSID.
307
307
 
308
308
  The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
309
309
 
310
+ If `password` is `None`, the password option is omitted from the command. This allows connecting to open networks or known networks that already have credentials stored.
311
+
310
312
  ```
311
313
  nmcli.device.wifi_connect(ssid: str,
312
- password: str,
314
+ password: Optional[str] = None,
313
315
  ifname: str = None,
314
316
  wait: int = None) -> None
315
317
  ```
@@ -523,6 +525,10 @@ nmcli.set_lang(lang: str) -> None
523
525
 
524
526
  ## Change Log
525
527
 
528
+ ### 1.8.0
529
+
530
+ - Allow `nmcli.device.wifi_connect` to accept `None` as password to connect to open or known networks without specifying a password.
531
+
526
532
  ### 1.7.0
527
533
 
528
534
  - Added `nmcli.connection.show_all` method with active filtering support
@@ -293,9 +293,11 @@ Connect to a Wi-Fi network specified by SSID or BSSID.
293
293
 
294
294
  The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
295
295
 
296
+ If `password` is `None`, the password option is omitted from the command. This allows connecting to open networks or known networks that already have credentials stored.
297
+
296
298
  ```
297
299
  nmcli.device.wifi_connect(ssid: str,
298
- password: str,
300
+ password: Optional[str] = None,
299
301
  ifname: str = None,
300
302
  wait: int = None) -> None
301
303
  ```
@@ -509,6 +511,10 @@ nmcli.set_lang(lang: str) -> None
509
511
 
510
512
  ## Change Log
511
513
 
514
+ ### 1.8.0
515
+
516
+ - Allow `nmcli.device.wifi_connect` to accept `None` as password to connect to open or known networks without specifying a password.
517
+
512
518
  ### 1.7.0
513
519
 
514
520
  - Added `nmcli.connection.show_all` method with active filtering support
@@ -1,5 +1,5 @@
1
1
  import re
2
- from typing import List, Tuple
2
+ from typing import List, Optional, Tuple
3
3
 
4
4
  from ._exception import ConnectionActivateFailedException
5
5
  from ._helper import add_fields_option_if_needed, add_wait_option_if_needed
@@ -75,7 +75,7 @@ class DeviceControlInterface:
75
75
 
76
76
  def wifi_connect(self,
77
77
  ssid: str,
78
- password: str,
78
+ password: Optional[str] = None,
79
79
  ifname: str = None,
80
80
  wait: int = None) -> None:
81
81
  raise NotImplementedError
@@ -182,11 +182,13 @@ class DeviceControl(DeviceControlInterface):
182
182
 
183
183
  def wifi_connect(self,
184
184
  ssid: str,
185
- password: str,
185
+ password: Optional[str] = None,
186
186
  ifname: str = None,
187
187
  wait: int = None) -> None:
188
188
  cmd = add_wait_option_if_needed(
189
- wait) + ['device', 'wifi', 'connect', ssid, 'password', password]
189
+ wait) + ['device', 'wifi', 'connect', ssid]
190
+ if password is not None:
191
+ cmd += ['password', password]
190
192
  if ifname is not None:
191
193
  cmd += ['ifname', ifname]
192
194
  r = self._syscmd.nmcli(cmd)
@@ -1,4 +1,4 @@
1
- from typing import List, Tuple
1
+ from typing import List, Optional, Tuple
2
2
 
3
3
  from .._device import DeviceControlInterface, DeviceDetails
4
4
  from ..data.device import Device, DeviceWifi
@@ -126,7 +126,7 @@ class DummyDeviceControl(DeviceControlInterface): # pylint: disable=too-many-pu
126
126
 
127
127
  def wifi_connect(self,
128
128
  ssid: str,
129
- password: str,
129
+ password: Optional[str] = None,
130
130
  ifname: str = None,
131
131
  wait: int = None) -> None:
132
132
  self._raise_error_if_needed()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nmcli
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: A python wrapper library for the network-manager cli client
5
5
  Author: ushiboy
6
6
  License-Expression: MIT
@@ -307,9 +307,11 @@ Connect to a Wi-Fi network specified by SSID or BSSID.
307
307
 
308
308
  The `wait` argument applies the same effect to the command as the `--wait` option. If it is omitted, the default behavior is followed.
309
309
 
310
+ If `password` is `None`, the password option is omitted from the command. This allows connecting to open networks or known networks that already have credentials stored.
311
+
310
312
  ```
311
313
  nmcli.device.wifi_connect(ssid: str,
312
- password: str,
314
+ password: Optional[str] = None,
313
315
  ifname: str = None,
314
316
  wait: int = None) -> None
315
317
  ```
@@ -523,6 +525,10 @@ nmcli.set_lang(lang: str) -> None
523
525
 
524
526
  ## Change Log
525
527
 
528
+ ### 1.8.0
529
+
530
+ - Allow `nmcli.device.wifi_connect` to accept `None` as password to connect to open or known networks without specifying a password.
531
+
526
532
  ### 1.7.0
527
533
 
528
534
  - Added `nmcli.connection.show_all` method with active filtering support
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nmcli"
7
- version = "1.7.0"
7
+ version = "1.8.0"
8
8
  description = "A python wrapper library for the network-manager cli client"
9
9
  readme = "README.md"
10
10
  authors = [{name = "ushiboy"}]
@@ -309,6 +309,27 @@ def test_wifi_connect():
309
309
  '--wait', '10', 'device', 'wifi', 'connect', ssid, 'password', password]
310
310
 
311
311
 
312
+ def test_wifi_connect_without_password():
313
+ s = DummySystemCommand()
314
+ device = DeviceControl(s)
315
+ ssid = 'Open AP'
316
+ ifname = 'wlan0'
317
+
318
+ device.wifi_connect(ssid, None)
319
+ assert s.passed_parameters == ['device', 'wifi', 'connect', ssid]
320
+
321
+ device.wifi_connect(ssid, None, ifname)
322
+ assert s.passed_parameters == [
323
+ 'device', 'wifi', 'connect', ssid, 'ifname', ifname]
324
+
325
+ device.wifi_connect(ssid, None, wait=10)
326
+ assert s.passed_parameters == [
327
+ '--wait', '10', 'device', 'wifi', 'connect', ssid]
328
+
329
+ device.wifi_connect(ssid)
330
+ assert s.passed_parameters == ['device', 'wifi', 'connect', ssid]
331
+
332
+
312
333
  def test_wifi_connect_when_connection_activate_failed():
313
334
  s = DummySystemCommand(
314
335
  '''Error: Connection activation failed: (7) Secrets were required, but not provided.
@@ -59,7 +59,8 @@ def test_reload_with_all_valid_flags():
59
59
  s = DummySystemCommand()
60
60
  general = GeneralControl(s)
61
61
  general.reload(['conf', 'dns-rc', 'dns-full'])
62
- assert s.passed_parameters == ['general', 'reload', 'conf', 'dns-rc', 'dns-full']
62
+ assert s.passed_parameters == ['general',
63
+ 'reload', 'conf', 'dns-rc', 'dns-full']
63
64
 
64
65
 
65
66
  def test_reload_with_invalid_flag():
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
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