Created
June 2, 2022 05:22
-
-
Save lognaturel/3a70ecba87dc881cdedb159ccd431b07 to your computer and use it in GitHub Desktop.
Given a string representing some ODK Collect user settings, create a configuration QR code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import json | |
import segno | |
import codecs | |
import zlib | |
settings = { | |
"general": { | |
"server_url": "https://demo.getodk.org" | |
}, | |
"admin": { | |
"edit_saved": False | |
} | |
} | |
qr_data = base64.b64encode(zlib.compress(json.dumps(settings).encode("utf-8"))) | |
code = segno.make(qr_data, micro=False) | |
code.save('settings.png', scale=5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment