Skip to content

Commit

Permalink
optional forward the security and hidden parameters to segno.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbr committed Jan 17, 2022
1 parent 210f489 commit d90d852
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions fritzconnection/lib/fritzwlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d90d852

Please sign in to comment.