Skip to content

Commit 186a502

Browse files
authored
Add Python syntax coloring to the README code example
1 parent 17c13ee commit 186a502

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

Diff for: README.md

+24-22
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,33 @@ You will be asked for an export password (or export phrase). In this example it
3838

3939
## Typical Usage
4040

41-
#!/usr/bin/env python
41+
```python
42+
#!/usr/bin/env python
4243

43-
from passbook.models import Pass, Barcode, StoreCard
44+
from passbook.models import Pass, Barcode, StoreCard
4445

45-
cardInfo = StoreCard()
46-
cardInfo.addPrimaryField('name', 'John Doe', 'Name')
46+
cardInfo = StoreCard()
47+
cardInfo.addPrimaryField('name', 'John Doe', 'Name')
4748

48-
organizationName = 'Your organization'
49-
passTypeIdentifier = 'pass.com.your.organization'
50-
teamIdentifier = 'AGK5BZEN3E'
51-
52-
passfile = Pass(cardInfo, \
53-
passTypeIdentifier=passTypeIdentifier, \
54-
organizationName=organizationName, \
55-
teamIdentifier=teamIdentifier)
56-
passfile.serialNumber = '1234567'
57-
passfile.barcode = Barcode(message = 'Barcode message')
58-
59-
# Including the icon and logo is necessary for the passbook to be valid.
60-
passfile.addFile('icon.png', open('images/icon.png', 'rb'))
61-
passfile.addFile('logo.png', open('images/logo.png', 'rb'))
62-
63-
# Create and output the Passbook file (.pkpass)
64-
password = '123456'
65-
passfile.create('certificate.pem', 'private.key', 'wwdr.pem', password , 'test.pkpass')
49+
organizationName = 'Your organization'
50+
passTypeIdentifier = 'pass.com.your.organization'
51+
teamIdentifier = 'AGK5BZEN3E'
52+
53+
passfile = Pass(cardInfo, \
54+
passTypeIdentifier=passTypeIdentifier, \
55+
organizationName=organizationName, \
56+
teamIdentifier=teamIdentifier)
57+
passfile.serialNumber = '1234567'
58+
passfile.barcode = Barcode(message = 'Barcode message')
59+
60+
# Including the icon and logo is necessary for the passbook to be valid.
61+
passfile.addFile('icon.png', open('images/icon.png', 'rb'))
62+
passfile.addFile('logo.png', open('images/logo.png', 'rb'))
63+
64+
# Create and output the Passbook file (.pkpass)
65+
password = '123456'
66+
passfile.create('certificate.pem', 'private.key', 'wwdr.pem', password , 'test.pkpass')
67+
```
6668

6769
## Note: Getting WWDR Certificate
6870

0 commit comments

Comments
 (0)