Skip to content

Commit b2201ce

Browse files
committed
initial commit
0 parents  commit b2201ce

File tree

11 files changed

+170
-0
lines changed

11 files changed

+170
-0
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
*.py[cod]
2+
3+
# C extensions
4+
*.so
5+
6+
# Packages
7+
*.egg
8+
*.egg-info
9+
build
10+
eggs
11+
parts
12+
bin
13+
var
14+
sdist
15+
develop-eggs
16+
.installed.cfg
17+
lib
18+
lib64
19+
20+
# Installer logs
21+
pip-log.txt
22+
23+
# Unit test / coverage reports
24+
.coverage
25+
.tox
26+
nosetests.xml
27+
28+
# Venv
29+
venv/

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2016 Pusher - support@pusher.com
2+
3+
The MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+
23+

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.md
2+
include requirements.txt

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Makefile for pusher_push_notifications
2+
all: run
3+
4+
rebuild_venv:
5+
rm -rf venv
6+
make venv
7+
8+
venv:
9+
test -d venv || python3 -m virtualenv venv
10+
venv/bin/pip3 install -Ur requirements.txt
11+
venv/bin/pip3 install -Ur dev_requirements.txt
12+
13+
run: venv
14+
@echo "Running pusher_push_notifications..."
15+
16+
check: test
17+
18+
test: venv
19+
@venv/bin/python3 -m nose -s
20+
21+
lint: venv
22+
@venv/bin/python3 -m pylint ./pusher_push_notifications/*.py
23+

README.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Pusher Push Notifications Python server SDK
2+
===========================================
3+
4+
Installation
5+
------------
6+
The Pusher Notifications Python server SDK is available on PyPi
7+
`here <http://www.python.org/>`_.
8+
9+
You can install this SDK by using
10+
`pip <https://pip.pypa.io/en/stable/installing/`_:
11+
12+
.. code:: bash
13+
14+
$ pip install pusher_push_notifications
15+
16+
17+
Usage
18+
-----
19+
20+
Configuring the SDK for Your Instance
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
Use your instance id and secret (you can get these from the
23+
`dashboard <https://dash.pusher.com>`_) to create a PushNotifications instance:
24+
25+
.. code:: python
26+
27+
import PushNotifications from pusher_push_notifications
28+
29+
pn_client = PushNotifications(
30+
instance_id='YOUR_INSTANCE_ID_HERE',
31+
secret_key='YOUR_SECRET_KEY_HERE',
32+
)
33+
34+
Publishing a Notification
35+
~~~~~~~~~~~~~~~~~~~~~~~~~
36+
37+
Once you have created your PushNotifications instance you can publish a push notification to your registered & subscribed devices:
38+
.. code:: python
39+
40+
response = pn_client.publish({'interests': ['hello'], 'apns': {'aps': {'alert': 'Hello!'}}})
41+
42+
print(response['publishId'])

dev_requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nose
2+
pylint

pusher_push_notifications/__init__.py

Whitespace-only changes.

requirements.txt

Whitespace-only changes.

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[bdist_wheel]
2+
universal=1
3+
4+
[metadata]
5+
description-file=README.md

setup.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from setuptools import setup, find_packages
2+
from codecs import open
3+
from os import path
4+
5+
__version__ = '0.9.0'
6+
7+
here = path.abspath(path.dirname(__file__))
8+
9+
# Get the long description from the README file
10+
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
11+
long_description = f.read()
12+
13+
# get the dependencies and installs
14+
with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
15+
all_reqs = f.read().split('\n')
16+
17+
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
18+
dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')]
19+
20+
setup(
21+
author='Pusher',
22+
author_email='support@pusher.com',
23+
classifiers=[
24+
'Development Status :: 3 - Alpha',
25+
'Intended Audience :: Developers',
26+
'Programming Language :: Python :: 3',
27+
],
28+
dependency_links=dependency_links,
29+
description='Pusher Push Notifications Python server SDK',
30+
include_package_data=True,
31+
install_requires=install_requires,
32+
long_description=long_description,
33+
name='pusher_push_notifications',
34+
packages=find_packages(exclude=['tests']),
35+
version=__version__,
36+
)

0 commit comments

Comments
 (0)