Skip to content

Instantly share code, notes, and snippets.

@birinder-lobana
Created June 28, 2022 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save birinder-lobana/8240a4a109acb4051b26c6d4f145c08a to your computer and use it in GitHub Desktop.
Save birinder-lobana/8240a4a109acb4051b26c6d4f145c08a to your computer and use it in GitHub Desktop.
Create a Static QR code using Python SDK
from openscreen import Openscreen
import os
#Obtain your access key and secret from Openscreen Dashboard
ospro = Openscreen(access_key=os.environ.get('OS_ACCESS_KEY'), access_secret=os.environ.get('OS_ACCESS_SECRET'))
#Create a new project on Openscreen Dashboard. Paste the projectId below
projectId = os.environ.get('PROJECT_ID')
#Create an Asset with a QR code
my_asset_response = ospro.project(projectId).assets().create({
'name': '123 Main Steet Sign',
'description': 'Sign for 123 Main Street, Toronto',
'customAttributes': {
'type': 'Sale',
'MLS#': '123ABC'
},
'qrCodes': [{
'intent': 'https://my-real-estate-website.com/listingId',
'intentType': 'STATIC_REDIRECT',
'status': 'ACTIVE'
}]
})
#Fetch the QR Code Image in png format
qr_code_png = ospro.qrCode(my_asset_response.asset.qrCodes[0].qrCodeId).get({'format':'png'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment