-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKG-INFO
95 lines (67 loc) · 3.38 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Metadata-Version: 1.1
Name: sseclient
Version: 0.0.12
Summary: Python client library for reading Server Sent Event streams.
Home-page: https://bitbucket.org/btubbs/sseclient/
Author: Brent Tubbs
Author-email: [email protected]
License: UNKNOWN
Description: =================
Python SSE Client
=================
This is a Python client library for iterating over http Server Sent Event (SSE)
streams (also known as EventSource, after the name of the Javascript interface
inside browsers). The SSEClient class accepts a url on init, and is then an
iterator over messages coming from the server.
Installation
------------
Use pip::
pip install sseclient
Usage
-----
::
from sseclient import SSEClient
messages = SSEClient('http://mysite.com/sse_stream/')
for msg in messages:
do_something_useful(msg)
Each message object will have a 'data' attribute, as well as optional 'event',
'id', and 'retry' attributes.
Optional init parameters:
- last_id: If provided, this parameter will be sent to the server to tell it to
return only messages more recent than this ID.
- retry: Number of milliseconds to wait after disconnects before attempting to
reconnect. The server may change this by including a 'retry' line in a
message. Retries are handled automatically by the SSEClient object.
You may also provide any additional keyword arguments supported by the
Requests_ library, such as a 'headers' dict and a (username, password) tuple
for 'auth'.
Development
-----------
Install the library in editable mode::
pip install -e .
Install the test dependencies::
pip install pytest backports.unittest_mock
Run the tests with py.test::
(sseclient)vagrant sseclient $ py.test
===================== test session starts ======================
platform linux2 -- Python 2.7.6 -- py-1.4.30 -- pytest-2.7.2
rootdir: /vagrant/code/sseclient, inifile:
plugins: backports.unittest-mock
collected 11 items
test_sseclient.py ...........
================== 11 passed in 0.19 seconds ===================
There are a couple TODO items in the code for getting the implementation
completely in line with the finer points of the SSE spec.
Additional Resources
--------------------
- `HTML5Rocks Tutorial`_
- `Official SSE Spec`_
.. _Requests: http://docs.python-requests.org/en/latest/
.. _HTML5Rocks Tutorial: http://www.html5rocks.com/en/tutorials/eventsource/basics/
.. _Official SSE Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#server-sent-events
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3