Git Product home page Git Product logo

passbook's Introduction

Passbook

Build Status

Python library to create Apple Wallet (.pkpass) files (Apple Wallet has previously been known as Passbook in iOS 6 to iOS 8).

See the Wallet Topic Page and the Wallet Developer Guide for more information about Apple Wallet.

If you need the server side implementation (API / WebServices) in django you should check http://github.com/devartis/django-passbook.

Getting Started

  1. Get a Pass Type Id
  • Visit the iOS Provisioning Portal -> Pass Type IDs -> New Pass Type ID
  • Select pass type id -> Configure (Follow steps and download generated pass.cer file)
  • Use Keychain tool to export a Certificates.p12 file (need Apple Root Certificate installed)
  1. Generate the necessary certificate
    $ openssl pkcs12 -in "Certificates.p12" -clcerts -nokeys -out certificate.pem   
  1. Generate the key.pem
    $ openssl pkcs12 -in "Certificates.p12" -nocerts -out private.key

You will be asked for an export password (or export phrase). In this example it will be 123456, the script will use this as an argument to output the desired .pkpass

  1. Ensure you have M2Crypto installed

    sudo easy_install M2Crypto

Typical Usage

#!/usr/bin/env python

from passbook.models import Pass, Barcode, StoreCard

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')

Note: Getting WWDR Certificate

Certificate is available @ http://developer.apple.com/certificationauthority/AppleWWDRCA.cer

It can be exported from KeyChain into a .pem (e.g. wwdr.pem).

Testing

You can run the tests with py.test or optionally with coverage support (install pytest-cov first):

py.test --cov

You can also generate a HTML report of the coverage:

py.test --cov-report html

You can run the tests against multiple versions of Python by running tox which you need to install first.

Credits

Developed by devartis.

Contributors

Martin Bächtold

passbook's People

Contributors

23min avatar derfenix avatar ewjoachim avatar fara avatar ianlewis avatar izqui avatar janmasarik avatar jugutier avatar mbaechtold avatar nicoinn avatar poligarcia avatar riegie avatar sylvainemery avatar tobyberster avatar wannabehero avatar wasauce avatar zebtin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passbook's Issues

Generated Passbook can be opened by safari

Hello, I used this to do a pkpass test, but although all seems to be ok (as you can see in the attached screenshot)
Captura de pantalla 2020-12-24 a las 8 53 23
passbook viewer and safari say that they can't open the file. I was looking for all around, with no success could anyone help me?

Here there is my sample file http://handbolsantquirze.cat/passbook/rafa.pkpass, please download using chrome but not safari because it's not downloading on safari

Thanks to all! and Merry Xmas

Add support for Python 3

I'm in the process of adding support for Python 3.

Since M2Crypto is not compatible with Python 3 I'm looking into alternatives. The only crypto primitive used for creating passcode files is signing the manifest, so we don't really need to rely on a full-fledged crypto library (but it would be better because they know better than I do).

Anyway, the work is done in a branch of my fork at https://github.com/mbaechtold/passbook/tree/python3-m2crypto. Since other people are trying to do the same (at least @ssyms) I thought we should join forces.

My next step is to remove my custom signing library with pyOpenSSL which is compatible with Python 3 but does not officially support detached PKCS#7 signatures.

In the meantime, feel free to test my code at will.

Update from 2020-05-17: M2Crypto has added support for Python 3 in the meantime. So we may keep this dependency.

How I add currencyCode in primaryFields?

How can I added currencyCode in addPrimaryField method. I wanna create following json in addPrimaryField method,

  "storeCard" : {
    "primaryFields" : [
      {
        "key" : "balance",
        "label" : "remaining balance",
        "value" : 21.75,
        "currencyCode" : "USD"
      }
    ],

As I check addPrimaryField method there is only 3 parameter are accept.
passfile.passInformation.addPrimaryField('balance', 21.75, 'remaining balance')

I was found CurrencyField Class but I was not understand how to access CurrencyField Class with addAuxiliaryField Class. Thank you.

M2Crypto.EVP.EVPError: Unable to read private key in function pkey_read_pem.

Hi~
I have a problem with smime exceptions when reading pem files (smime.load_key(str(keyPemPath), certificatePemPath)), exception information: M2Crypto.EVP.EVPError: Unable to read private key in function pkey_read_pem.
Complete error:
Traceback (most recent call last):
   File "/Work/pythonWork/pkpass/test.py", line 15, in
     Smime.load_key(str(keypemPath), pemPath)
   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/M2Crypto/SMIME.py", line 163, in load_key
     Self.pkey = EVP.load_key(keyfile, callback)
   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/M2Crypto/EVP.py", line 395, in load_key
     Cptr = m2.pkey_read_pem(bio.bio, callback)
M2Crypto.EVP.EVPError: Unable to read private key in function pkey_read_pem.

Release 1.0.2 on PyPI

It would be nice to release 1.0.2 on PyPI. As for the changelog I suggest something like

Add compatibility with iOS 9

TypeError: Unicode-objects must be encoded before hashing

Hi
first at all thanks for the script

i tried to run my script on python 3 but I got the following error

someone can help me?

python3 generate.py
Traceback (most recent call last):
File "generate.py", line 25, in
passfile.create('certificate.pem', 'key.pem', 'wwdr.pem', password , 'test.pkpass')
File "/var/www/html/source/pass.bucksense.com/passbook-master/passbook/models.py", line 319, in create
manifest = self._createManifest(pass_json)
File "/var/www/html/source/pass.bucksense.com/passbook-master/passbook/models.py", line 332, in _createManifest
self._hashes['pass.json'] = hashlib.sha1(pass_json).hexdigest()
TypeError: Unicode-objects must be encoded before hashing

pkpass does not open on the watch

The pkpass fie open fine on iPhone and can be added to the Wallet on iPhone, but it cannot be added to the Apple Watch.
Specifically, I sent the pkpass file by text to myself. On the watch, tapping on the pkpass file does not add it to the Wallet on the Watch.
I am able to add the pkpass file generated by other apps to my watch
Am I doing something wrong?

Json file is here:

    •   {
    •     "description": "Garb",
    •     "formatVersion": 1,
    •     "organizationName": "Garb",
    •     "passTypeIdentifier": "pass.company.appname",
    •     "serialNumber": "Membership CardGarb",
    •     "teamIdentifier": "87XUXXLX5B",
    •     "suppressStripShine": false,
    ◦     "storeCard": {
    ▪       "primaryFields": [
    ▪         {
    ▪           "key": "name",
    ▪           "value": "Garb",
    ▪           "label": "Membership Card",
    ▪           "changeMessage": "",
    ▪           "textAlignment": "PKTextAlignmentLeft"
    ▪         }
    ◦       ],
    ▪       "secondaryFields": [
    ▪         {
    ▪           "key": "customer_id",
    ▪           "value": "1234",
    ▪           "label": "Member ID",
    ▪           "changeMessage": "",
    ▪           "textAlignment": "PKTextAlignmentLeft"
    ▪         }
    ◦       ]
    •     },
    ◦     "barcodes": [
    ▪       {
    ▪         "format": "PKBarcodeFormatQR",
    ▪         "message": "1234",
    ▪         "messageEncoding": "utf-8"
    ◦       }
    •     ],
    ◦     "barcode": {
    ◦       "format": "PKBarcodeFormatQR",
    ◦       "message": "1234",
    ◦       "messageEncoding": "utf-8"
    •     },
    •     "backgroundColor": "rgb(72, 93, 133)",
    •     "foregroundColor": "rgb(255, 255, 255)",
    •     "logoText": "Garb"
}

Location(s)

Am I mistaken or shouldn't the location(s) be in the form of an array?

Discussion: drop support for Python < 3?

I'm reaching out to the owners of this repo (i.e. @fara and @poligarcia) about the impeding end of support of Python 2.7.

Would it be ok for you to drop support for Python 2.7 by Januar 1st, 2020? This would make the update to Python 3 much easier.

I already have started adding support for Python 3 in #40 but did not feel comfortable enough to merge it.

Installation failed

pip install passbook

Out:

  Building wheel for M2Crypto (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      running bdist_wheel
      running build
      running build_py
      copying src/M2Crypto/RC4.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/ASN1.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/httpslib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/util.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Engine.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/DH.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/BN.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/X509.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/ftpslib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/EVP.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/__init__.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/BIO.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/SMIME.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2urllib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/callback.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2crypto.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/threading.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/DSA.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/six.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Rand.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/EC.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/RSA.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Err.py -> build/lib.linux-x86_64-3.10/M2Crypto
      creating build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      running egg_info
      writing src/M2Crypto.egg-info/PKG-INFO
      writing dependency_links to src/M2Crypto.egg-info/dependency_links.txt
      writing top-level names to src/M2Crypto.egg-info/top_level.txt
      reading manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'SWIG/*.i'
      warning: no files found matching 'SWIG/*.h'
      warning: no files found matching 'SWIG/*.def'
      warning: no files found matching 'SWIG/_m2crypto_wrap.c'
      warning: no files found matching 'M2Crypto/m2crypto.py'
      adding license file 'LICENCE'
      writing manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      running build_ext
      building 'M2Crypto._m2crypto' extension
      swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      swig -python -py3 -I/usr/lib/gcc/x86_64-linux-gnu/11/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include -D__x86_64__ -I/usr/include/python3.10 -I/usr/include/openssl -includeall -modern -builtin -outdir /tmp/pip-install-w4_5bctt/m2crypto_b038f298e59048fd8e7fcce5c8db99ca/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      error: command 'swig' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
  Running setup.py clean for M2Crypto
Successfully built passbook
Failed to build M2Crypto
Installing collected packages: M2Crypto, passbook
  Running setup.py install for M2Crypto ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for M2Crypto did not run successfully.
  │ exit code: 1
  ╰─> [65 lines of output]
      running install
      /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/RC4.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/ASN1.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/httpslib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/util.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Engine.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/DH.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/BN.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/X509.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/ftpslib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/EVP.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/__init__.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/BIO.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/SMIME.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2urllib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/callback.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2crypto.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/threading.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/DSA.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/six.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Rand.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/EC.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/RSA.py -> build/lib.linux-x86_64-3.10/M2Crypto
      copying src/M2Crypto/Err.py -> build/lib.linux-x86_64-3.10/M2Crypto
      creating build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      copying src/M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.10/M2Crypto/SSL
      running egg_info
      writing src/M2Crypto.egg-info/PKG-INFO
      writing dependency_links to src/M2Crypto.egg-info/dependency_links.txt
      writing top-level names to src/M2Crypto.egg-info/top_level.txt
      reading manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'SWIG/*.i'
      warning: no files found matching 'SWIG/*.h'
      warning: no files found matching 'SWIG/*.def'
      warning: no files found matching 'SWIG/_m2crypto_wrap.c'
      warning: no files found matching 'M2Crypto/m2crypto.py'
      adding license file 'LICENCE'
      writing manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      running build_ext
      building 'M2Crypto._m2crypto' extension
      swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      swig -python -py3 -I/usr/lib/gcc/x86_64-linux-gnu/11/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include -D__x86_64__ -I/usr/include/python3.10 -I/usr/include/openssl -includeall -modern -builtin -outdir /tmp/pip-install-w4_5bctt/m2crypto_b038f298e59048fd8e7fcce5c8db99ca/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      error: command 'swig' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> M2Crypto

pip -V

Out:

pip 22.1.1 from /home/benyamin/.local/lib/python3.10/site-packages/pip (python 3.10)

The passbook is not recognized by the iphone

i have make a smple python app that create the passbook files.

this is the code

cardinfo = StoreCard()
        cardinfo.addPrimaryField("name","Name:","name")

        passTypeIdentifier = 'pass.<mytypeidentifier>'
        teamIdentifier = '<teamidentifier>'
        organizationName = 'Test by Cingusoft'

        passfile = Pass(cardinfo,passTypeIdentifier=passTypeIdentifier,organizationName=organizationName,teamIdentifier=teamIdentifier)
        passfile.serialNumber = "34556"
        passfile.description = "this is a passbook description"
        passfile.barcode = Barcode(message = 'Barcode message')
        passfile.addFile('icon.png',open(os.path.join(os.path.realpath(os.path.dirname(__file__)),'icn.png')))
        passfile.addFile('logo.png',open(os.path.join(os.path.realpath(os.path.dirname(__file__)),'logo.png')))
        passfile.create(os.path.join(os.path.realpath(os.path.dirname(__file__)),"../certificates/certificate.pem"),
            os.path.join(os.path.realpath(os.path.dirname(__file__)),"../certificates/key.pem"),
            os.path.join(os.path.realpath(os.path.dirname(__file__)),"../certificates/intermediate.pem"),
            '123456,
            'test.pkpass') # Create and output the Passbook file (.pkpass)

the library create the passbook file test.pkpass
i send it eith emails and the Mail application recognize the passbook file.
when i open the same email with iphone he don't recognize a passbook file.
if i "upload" the passbook file from the Mail app, nothing happen.

i have used the correct certificates.
Have some problems?
have you tested with your iphone?

thank's in advance

New release planned ?

@fara @poligarcia @mbaechtold

Good morning, are you planning to do a release with all the new changes (specially support for Python 3)?

Current release dates from 25 Jul 2016 (v1.0.2). It would be great to get the latest code when installing the packages via pip.

thanks!

How to change barcode format

How to change the barcode format to something other than the default PDF417?

If I do passfile.barcode = Barcode(message = 'message', format=BarcodeFormat.CODE128) I get a NameError - name 'BarcodeFormat' is not defined.

Sorry for my noob question :)

Replace M2Crypto with cryptography

@shivaRamdeen has created a fork that uses cryptography library instead of m2crypto if anyone is looking for an alternative, especially for windows dev env.

Let's explore what it would mean to incorporate the fork into our repository.

No return value for _createZip

Should def _createZip(self, pass_json, manifest, signature, zip_file=None): return zf?

Not so sure, since self.zip_file is never accessed.

Can't generate pkpass.file

Hi there,

I was following the readme instruction, and put my certificate in test/certificates folder. And then just install all package needed, run the py.test. It shows
image
Do you have any idea how can I generate pkpass.file for this ?

Much appreciated.

Quentin

There are two certificates for applewwdrca

Hi, Apple have a couple of certificates one expire in 2023 and the other in 2030. Which one I need?
On the other hand regarding with password ... this password is for what?

thanks a lot!!

The current version (1.0.1dev) is not on PyPI

I'm using your awesome project in a library of mine, and I use my library in one of my projects.
I'm mixing pip and setuptools to install everything and pip won't fetch the last version on github, but it tries to get it on PyPI. Alas, only the version 1.0.0 is on PyPI!
Could you make a new release? Maybe 1.0.2?

Thanks a lot!

obtain cert.pem and key.pem

Hi,
i have a question.

i have created the certificate into the provisioning portal.
i have downloaded the .cert file form this portal.
so,
how i obtain the certificate and the key.pem file.
sorry for this stupid and newbie question but i'm not a crypto expert :-)

barcode issue.

should be, d.update({'barcode': self.barcode.json_dict()})

Add methods for adding header and auxiliary fields

I'm not sure why they're missing but it would be nice to have these convenience methods as well:

diff --git a/passbook/models.py b/passbook/models.py
index bfcbc6b..f3eaf8d 100644
--- a/passbook/models.py
+++ b/passbook/models.py
@@ -121,12 +121,18 @@ class PassInformation(object):
         self.backFields = []
         self.auxiliaryFields = []

+    def addHeaderField(self, key, value, label):
+        self.headerFields.append(Field(key, value, label))
+
     def addPrimaryField(self, key, value, label):
         self.primaryFields.append(Field(key, value, label))

     def addSecondaryField(self, key, value, label):
         self.secondaryFields.append(Field(key, value, label))

+    def addAuxiliaryField(self, key, value, label):
+        self.auxiliaryFields.append(Field(key, value, label))
+
     def addBackField(self, key, value, label):
         self.backFields.append(Field(key, value, label))

New Tag for current state of code

The current state of the master branch is great and it fixes some of the import issues one might have had with the io package.
To easily reference this state of the code it would be beneficial to have a new tag released so one does not need to reference the commit in their requirements file.

passbook generates both numberStyle and currencyCode on the balance field

The passbook library is generating passes that are not loadable by IOS due to the fact that it defaults 'numberStyle' on a the balance header. This is reproduced by explicitly setting the currencyCode as shown in the unit tests in the attached PR.

I submitted pull #37 as a way to reproduce the problem with a possible fix. Thanks for your consideration.

John

No module named 'StringIO'

By the execution of the following line I encounter with the following error:

from passbook.models import Pass

Out:

File ~/.local/lib/python3.10/site-packages/passbook/models.py:11, in <module>
      9     from cStringIO import StringIO
     10 except ImportError:
---> 11     from StringIO import StringIO
     13 import hashlib
     14 import zipfile

ModuleNotFoundError: No module named 'StringIO'

iOS 9 barcodes key not supported

Apple introduced barcodes as a replacement to barcode in iOS9, which is now required to display a barcode. barcodes is an array of barcode items. barcode as a top-level key is now depreciated, although it's allowed to keep pass compatibility with iOS 8.

barcodes also supports a new format: PKBarcodeFormatCode128.

Here is where Apple discusses this change.

Add CurrencyField

It would be nice to have a CurrencyField that extends NumberField:

class CurrencyField(NumberField):

def __init__(self, key, value, label = '', currencyCode = ''):
    super(CurrencyField, self).__init__(key, value, label)
    self.currencyCode = currencyCode # ISO 4217 currency code

def json_dict(self):
    return self.__dict__

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.