From d90d852a7ca18778c9c034ff70fd7dfa02938b5d Mon Sep 17 00:00:00 2001 From: Klaus Bremer Date: Mon, 17 Jan 2022 13:16:50 +0100 Subject: [PATCH] optional forward the security and hidden parameters to segno. --- fritzconnection/lib/fritzwlan.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fritzconnection/lib/fritzwlan.py b/fritzconnection/lib/fritzwlan.py index 2705bd8..c70ea2a 100644 --- a/fritzconnection/lib/fritzwlan.py +++ b/fritzconnection/lib/fritzwlan.py @@ -28,7 +28,7 @@ DEFAULT_PASSWORD_LENGTH = 12 -def get_wifi_qr_code(instance, kind='svg'): +def get_wifi_qr_code(instance, kind='svg', security=None, hidden=False): """ Returns a file-like object providing a bytestring representing a qr-code for wlan access. `instance` is a FritzWLAN or FritzGuestWLAN @@ -58,9 +58,22 @@ def get_wifi_qr_code(instance, kind='svg'): called directly. .. versionadded:: 1.9.0 + + The parameters `security` and `hidden` allow to forward these + informations to the `segno` library. `security` is `None` or a + string like `WPA2`. `hidden` is a boolean value indicating the + visibility of the network . + + .. versionadded:: 1.9.1 + """ stream = io.BytesIO() - qr_code = segno.helpers.make_wifi(instance.ssid, instance.get_password()) + qr_code = segno.helpers.make_wifi( + ssid=instance.ssid, + password=instance.get_password(), + security=security, + hidden=hidden + ) qr_code.save(out=stream, kind=kind) stream.seek(0) return stream