Giter Site home page Giter Site logo

nikitph / kalyke Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nnsnodnb/kalyke

0.0 1.0 0.0 118 KB

A library for interacting with APNs and VoIP using HTTP/2.

Home Page: https://pypi.org/project/kalyke-apns

License: MIT License

Python 100.00%

kalyke's Introduction

kalyke

image Maintainability Codacy Badge

PyPI Package version Python Supported versions PyPI status wheel format implementation LICENSE

A library for interacting with APNs and VoIP using HTTP/2.

Installation

kalyke requires python 3.5 or later.

$ pip install kalyke-apns

Usage

APNs

from kalyke.client import APNsClient
from kalyke.payload import PayloadAlert, Payload


payload_alert = PayloadAlert(title='YOUR TITLE', body='YOUR BODY')
alert = Payload(alert=payload_alert, badge=1, sound='default')

client = APNsClient(
    team_id='YOUR_TEAM_ID', auth_key_id='AUTH_KEY_ID', auth_key_filepath='/path/to/AuthKey_AUTH_KEY_ID.p8',
    bundle_id='com.example.App', use_sandbox=True, force_proto='h2'
)

# Send single push notification

registration_id = 'a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500'

result = client.send_message(registration_id, alert)

# Send multiple push notifications
registration_ids = [
    '87b0a5ab7b91dce26ea2c97466f7b3b82b5dda4441003a2d8782fffd76515b73', '22a1b20cb67a43da4a8f006176788aa20271ac2e3ac0da0375ae3dc1db0de210'
]

results = client.send_bulk_message(registration_ids, alert)

VoIP

from kalyke.client import VoIPClient


client = VoIPClient(
    auth_key_filepath='/path/to/YOUR_VOIP_CERTIFICATE.pem',
    bundle_id='com.example.App.voip', use_sandbox=True
)

alert = {
    'key': 'value'
}

# Send single VoIP notification

registration_id = '14924adeeabaacc8b38cfd766965abffd0ee572a5a89e7ee26e6009a3f1a8e8a'

result = client.send_message(registration_id, alert)

# Send multiple VoIP notifications

registration_ids = [
    '84b7120bf190d171ff904bc943455d6081274714b32c486fa28814be7ee921fb', 'afaa8dcedc99d420e35f7435edad4821dbad3c8c7d5071b2697da9bd7a5037ad'
]

results = client.send_bulk_message(registration_ids, alert)

Todo

  • Tests

License

This software is licensed under the MIT License (See LICENSE).

kalyke's People

Contributors

dependabot[bot] avatar nikitph avatar nnsnodnb avatar

Watchers

 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.