pywebpush 0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/PKG-INFO +74 -0
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/SOURCES.txt +8 -0
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/dependency_links.txt +1 -0
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/not-zip-safe +1 -0
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/requires.txt +3 -0
- home/jrconlin/src/mozilla/push/pywebpush/lib/python2.7/site-packages/pywebpush-0.2-py2.7.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 1.1
|
|
2
|
+
Name: pywebpush
|
|
3
|
+
Version: 0.2
|
|
4
|
+
Summary: WebPush publication library
|
|
5
|
+
Home-page: https://github.com/jrconlin/pywebpush
|
|
6
|
+
Author: jr conlin
|
|
7
|
+
Author-email: src+webpusher@jrconlin.com
|
|
8
|
+
License: MPL2
|
|
9
|
+
Description: # Webpush Data encryption library for Python
|
|
10
|
+
|
|
11
|
+
This is a work in progress.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
You'll need to run `python virtualenv`.
|
|
16
|
+
Then
|
|
17
|
+
```
|
|
18
|
+
bin/pip install -r requirements.txt
|
|
19
|
+
bin/python setup.py develop
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
In the browser, the promise handler for
|
|
25
|
+
[registration.pushManager.subscribe()](https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe)
|
|
26
|
+
returns a
|
|
27
|
+
[PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)
|
|
28
|
+
object. This object has a .toJSON() method that will return a JSON
|
|
29
|
+
object that contains all the info we need to encrypt and push data.
|
|
30
|
+
|
|
31
|
+
As illustration, a subscription info object may look like:
|
|
32
|
+
```
|
|
33
|
+
{"endpoint": "https://updates.push.services.mozilla.com/push/v1/gAA...", "keys": {"auth": "k8J...", "p256dh": "BOr..."}}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
How you send the PushSubscription data to your backend, store it
|
|
37
|
+
referenced to the user who requested it, and recall it when there's
|
|
38
|
+
new a new push subscription update is left as an excerise for the
|
|
39
|
+
reader.
|
|
40
|
+
|
|
41
|
+
The data can be any serial content (string, bit array, serialized
|
|
42
|
+
JSON, etc), but be sure that your receiving application is able to
|
|
43
|
+
parse and understand it. (e.g. `data = "Mary had a little lamb."`)
|
|
44
|
+
|
|
45
|
+
`headers` is a `dict`ionary of additional HTTP header values (e.g.
|
|
46
|
+
[VAPID](https://github.com/mozilla-services/vapid/tree/master/python)
|
|
47
|
+
self identification headers). It is optional and may be omitted.
|
|
48
|
+
|
|
49
|
+
to send:
|
|
50
|
+
```
|
|
51
|
+
WebPusher(subscription_info).send(data, headers)
|
|
52
|
+
```
|
|
53
|
+
You can also simply encode the data to send later by calling
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
encoded = WebPush(subscription_info).encode(data)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## 0.2 (2016-04-27)
|
|
61
|
+
feat: Added tests, restructured code
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## 0.1 (2016-04-25)
|
|
65
|
+
|
|
66
|
+
Initial release
|
|
67
|
+
|
|
68
|
+
Keywords: push webpush publication
|
|
69
|
+
Platform: UNKNOWN
|
|
70
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
71
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
72
|
+
Classifier: Programming Language :: Python
|
|
73
|
+
Classifier: Programming Language :: Python :: 2
|
|
74
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|