Code Monkey home page Code Monkey 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 and key .pem files

    openssl pkcs12 -in "Certificates.p12" -clcerts -nokeys -out certificate.pem openssl pkcs12 -in "Certificates.p12" -nocerts -out key.pem

  2. 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', 'r'))
passfile.addFile('logo.png', open('images/logo.png', 'r'))

# Create and output the Passbook file (.pkpass) 
passfile.create('certificate.pem', 'key.pem', 'wwdr.pem', '123456', '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.

passbook's People

Contributors

fara avatar poligarcia avatar ssyms avatar mbaechtold avatar derfenix avatar wasauce avatar 23min avatar ianlewis avatar izqui avatar tobyberster avatar riegie avatar wannabehero avatar sylvainemery avatar zebtin avatar

Watchers

James Cloos avatar  avatar

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.