From 186a5027744f35cc1271a4baa1a892f5c9e44c4c Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Thu, 14 Oct 2021 23:45:20 +0200 Subject: [PATCH] Add Python syntax coloring to the README code example --- README.md | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d957b8c..24c7299 100644 --- a/README.md +++ b/README.md @@ -38,31 +38,33 @@ You will be asked for an export password (or export phrase). In this example it ## Typical Usage - #!/usr/bin/env python +```python +#!/usr/bin/env python - from passbook.models import Pass, Barcode, StoreCard +from passbook.models import Pass, Barcode, StoreCard - cardInfo = StoreCard() - cardInfo.addPrimaryField('name', 'John Doe', 'Name') +cardInfo = StoreCard() +cardInfo.addPrimaryField('name', 'John Doe', 'Name') - organizationName = 'Your organization' - passTypeIdentifier = 'pass.com.your.organization' - teamIdentifier = 'AGK5BZEN3E' - - passfile = Pass(cardInfo, \ - passTypeIdentifier=passTypeIdentifier, \ - organizationName=organizationName, \ - teamIdentifier=teamIdentifier) - passfile.serialNumber = '1234567' - passfile.barcode = Barcode(message = 'Barcode message') - - # Including the icon and logo is necessary for the passbook to be valid. - passfile.addFile('icon.png', open('images/icon.png', 'rb')) - passfile.addFile('logo.png', open('images/logo.png', 'rb')) - - # Create and output the Passbook file (.pkpass) - password = '123456' - passfile.create('certificate.pem', 'private.key', 'wwdr.pem', password , 'test.pkpass') +organizationName = 'Your organization' +passTypeIdentifier = 'pass.com.your.organization' +teamIdentifier = 'AGK5BZEN3E' + +passfile = Pass(cardInfo, \ + passTypeIdentifier=passTypeIdentifier, \ + organizationName=organizationName, \ + teamIdentifier=teamIdentifier) +passfile.serialNumber = '1234567' +passfile.barcode = Barcode(message = 'Barcode message') + +# Including the icon and logo is necessary for the passbook to be valid. +passfile.addFile('icon.png', open('images/icon.png', 'rb')) +passfile.addFile('logo.png', open('images/logo.png', 'rb')) + +# Create and output the Passbook file (.pkpass) +password = '123456' +passfile.create('certificate.pem', 'private.key', 'wwdr.pem', password , 'test.pkpass') +``` ## Note: Getting WWDR Certificate