A useful package to help you create Google Wallet Passes.
Project description
GoogleWalletPassGenerator
Introduction
GoogleWalletPassGenerator is a Python package designed to simplify the process of creating passes for Google Wallet. This package provides an easy-to-use interface for generating various types of passes, including event tickets, boarding passes, loyalty cards, and more, compatible with Google Wallet.
Features
- Easy creation of Google Wallet passes.
- Support for multiple pass types (event tickets, boarding passes, etc.).
- Customizable pass templates.
- Convenient serialization to JSON format compatible with Google Wallet API.
Installation
To install GoogleWalletPassGenerator, run the following command:
pip install GoogleWalletPassGenerator
Usage
Here is a basic example of how to create an EventTicket class
from GoogleWalletPassGenerator.eventticket import EventTicketManager
from GoogleWalletPassGenerator.types import TranslatedString, LocalizedString, EventTicketClass, EventTicketClassId, EventTicketObject, EventTicketObjectId, Barcode, ObjectsToAddToWallet, EventTicketIdentifier
from GoogleWalletPassGenerator.enums import ReviewStatus, State, BarcodeType, BarcodeRenderEncoding
from GoogleWalletPassGenerator.serializer import serialize_to_json
service_account_json = 'path_to_service_account_json'
manager = EventTicketManager(service_account_json)
issuerId = 'ISSUER_ID'
uniqueClassId = 'UNIQUE_CLASS_ID'
uniqueObjectId = 'UNIQUE_OBJECT_ID'
eventTicketClass = serialize_to_json(
EventTicketClass(
id=EventTicketClassId(
issuerId=issuerId,
uniqueId=uniqueClassId
),
issuerName="Crafture",
eventName=LocalizedString(
defaultValue=TranslatedString(
"en-US", "EVENT_NAME"
),
),
reviewStatus=ReviewStatus.UNDER_REVIEW, # Or any other status from the enum
)
)
manager.create_class(eventTicketClass)
Here is a basic example of how to create an EventTicket Object of a class
eventTicketObject = serialize_to_json(
EventTicketObject(
id=EventTicketObjectId(
issuerId=issuerId,
uniqueId=uniqueObjectId
),
classId=EventTicketClassId(
issuerId=issuerId,
uniqueId=uniqueClassId
),
state=State.ACTIVE, # Or any other state from the enum
barcode=Barcode(
type=BarcodeType.QR_CODE, # Or any other barcode from the enum
renderEncoding=BarcodeRenderEncoding.UTF_8, # Or any other render encoding from the enum
value="https://www.crafture.com/",
)
)
)
manager.create_object(eventTicketObject)
You can now create the add to Google Wallet urls:
objectsToAdd = serialize_to_json(
ObjectsToAddToWallet(
[
EventTicketIdentifier(
id=EventTicketObjectId(
issuerId=issuerId,
uniqueId=uniqueObjectId
),
classId=EventTicketClassId(
issuerId=issuerId,
uniqueId=uniqueClassId
),
)
]
)
)
walletUrls = manager.create_add_event_ticket_urls(objectsToAdd)
print(walletUrls)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for GoogleWalletPassGenerator-1.0.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e75d3ce98faf633ad5a78fcc40e895c41a2eb0d5a3997c3dd3efde73eab92bbb |
|
MD5 | 0930ad522ecf7712a2ad474495d70f36 |
|
BLAKE2b-256 | 9db01bdc7c838ea70238d4c26311fc671d722b1cbf119816305dc11bc17ceb15 |
Close
Hashes for GoogleWalletPassGenerator-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de45c03f6c5809427fb55055ff90de4b5466cad9792cee152773d068c6b63f6b |
|
MD5 | c1f1fa2bd89849f200f14b2d72a4d823 |
|
BLAKE2b-256 | ad1f24cdb62138ffe3660275f35f1285f310cbed9034c3924f9041081233f585 |