GithubHelp home page GithubHelp logo

timtan / passbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devartis/passbook

0.0 1.0 0.0 134 KB

Python library to read/write (reading in progress) Apple Passbook (.pkpass) files

Home Page: http://www.devartis.com/

License: MIT License

Python 100.00%

passbook's Introduction

Passbook

Passbook

Python library to read/write Apple Passbook (.pkpass) files

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
  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', 'r'))
passfile.addFile('logo.png', open('images/logo.png', 'r'))
passfile.create('certificate.pem', 'key.pem', 'wwdr.pem', '123456', 'test.pkpass') # Create and output the Passbook file (.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)

Developed by devartis <http://www.devartis.com>.

passbook's People

Contributors

fara avatar poligarcia avatar wasauce avatar 23min avatar ianlewis avatar izqui avatar tobyberster avatar timtan avatar wannabehero avatar zebtin avatar

Watchers

James Cloos 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.