@@ -38,31 +38,33 @@ You will be asked for an export password (or export phrase). In this example it
38
38
39
39
## Typical Usage
40
40
41
- #!/usr/bin/env python
41
+ ``` python
42
+ # !/usr/bin/env python
42
43
43
- from passbook.models import Pass, Barcode, StoreCard
44
+ from passbook.models import Pass, Barcode, StoreCard
44
45
45
- cardInfo = StoreCard()
46
- cardInfo.addPrimaryField('name', 'John Doe', 'Name')
46
+ cardInfo = StoreCard()
47
+ cardInfo.addPrimaryField(' name' , ' John Doe' , ' Name' )
47
48
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
+ ```
66
68
67
69
## Note: Getting WWDR Certificate
68
70
0 commit comments