Last active
June 27, 2022 16:00
-
-
Save birinder-lobana/c69efc6f69412c7d38eae16fdaa82429 to your computer and use it in GitHub Desktop.
Create an Asset and a QR Code using Openscreen's python SDK
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
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': 'DYNAMIC_REDIRECT', | |
'dynamicRedirectType': 'SCAN_ID_IN_QUERY_STRING_PARAMETER', | |
'locatorKeyType': 'SHORT_URL', | |
'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