Skip to content

Instantly share code, notes, and snippets.

@lognaturel
Created June 2, 2022 05:22
Show Gist options
  • Save lognaturel/3a70ecba87dc881cdedb159ccd431b07 to your computer and use it in GitHub Desktop.
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
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