Skip to content

Commit

Permalink
Merge pull request devartis#58 from ewjoachim/patch-1
Browse files Browse the repository at this point in the history
Add Python syntax coloring to the README code example
  • Loading branch information
mbaechtold authored Oct 15, 2021
2 parents 17c13ee + 186a502 commit 00aaccb
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 00aaccb

Please sign in to comment.