Skip to main content

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

passninja-1.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

passninja-1.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file passninja-1.1.0.tar.gz.

File metadata

  • Download URL: passninja-1.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for passninja-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8be30e8d0afece9ac045b4a7cd55a45191fe04ac13931aa22776575e2a5f089e
MD5 fc96f1eade8595e243d1efb9e70b6239
BLAKE2b-256 d797c08434f9a125a32218b03556eeead9573f77f8b3c0b2cce9c136cdeb65fe

See more details on using hashes here.

File details

Details for the file passninja-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: passninja-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for passninja-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7e984d798e668142083fcde2a999e7fded1a12b86d9d2279f06591a7dfc13b6
MD5 501b160a5768ef36717a8569fddc1aa5
BLAKE2b-256 6d60bc7d265296e35c61bd178221f9aa5c5b61c62419486e3d67ffcad8e55504

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page