PassNinja API library for python
Project description
passninja-python
Use passninja-python as a PyPi or Anaconda module.
Contents
Installation
Install via pip:
pip install passninja
Usage
PassNinjaClient
Use this class to create a PassNinjaClient
object. Make sure to
pass your user credentials to make any authenticated requests.
import passninja
account_id = '**your-account-id**'
api_key = '**your-api-key**'
pass_ninja_client = passninja.PassNinjaClient(account_id, api_key)
We've placed our demo user API credentials in this example. Replace it with your actual API credentials to test this code through your PassNinja account and don't hesitate to contact PassNinja with our built in chat system if you'd like to subscribe and create your own custom pass type(s).
For more information on how to use passninja-python
once it loads, please refer to
the PassNinja JS API reference
PassNinjaClientMethods
This library currently supports methods for creating, getting, updating, and deleting passes via the PassNinja api. The methods are outlined below.
Create
simple_pass_object = pass_ninja_client.passes.create(
'demo.coupon', # passType
{'discount': '50%', 'memberName': 'John'} # passData
)
print(simple_pass_object.url)
print(simple_pass_object.passType)
print(simple_pass_object.serialNumber)
Get
detailed_pass_object = pass_ninja_client.passes.get(
'demo.coupon', # passType
'97694bd7-3493-4b39-b805-20e3e5e4c770' # serialNumber
)
Update
simple_pass_object = pass_ninja_client.passes.put(
'demo.coupon', # passType
'97694bd7-3493-4b39-b805-20e3e5e4c770', # serialNumber
{'discount': '100%', 'memberName': 'Ted'} # passData
)
Delete
deleted_pass_serial_number = pass_ninja_client.passes.delete(
'demo.coupon', # passType,
'97694bd7-3493-4b39-b805-20e3e5e4c770' # serialNumber
)
print('Pass deleted. Serial_number: ', deleted_pass_serial_number)
Documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file passninja-1.0.tar.gz
.
File metadata
- Download URL: passninja-1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 921a0c1660fb4fb64fd80f525f060b3cf12a4d23c6e2b5bde70935b4d68c6fab |
|
MD5 | 762a444a3872763c0ed94b4a1dc8fb15 |
|
BLAKE2b-256 | e31fec640a28312459bc353a998b2426d1877ece8f4b482e51f8dbe56967fa4f |