Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tokeshu/eventsource-parser
A pure python, framework agnostic EventSource parser
https://github.com/tokeshu/eventsource-parser
Last synced: about 2 months ago
JSON representation
A pure python, framework agnostic EventSource parser
- Host: GitHub
- URL: https://github.com/tokeshu/eventsource-parser
- Owner: tOkeshu
- License: apache-2.0
- Created: 2013-02-16T21:33:03.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-28T21:24:39.000Z (almost 12 years ago)
- Last Synced: 2024-04-14T14:48:03.472Z (8 months ago)
- Language: Python
- Size: 137 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
EventSource Parser
==================A framework agnostic EventSource Parser.
::
>>> source =
"""
id: 1
event: chat
data: hey, how are you?id: 2
event: chat
data: fine, thank you:ping
"""
>>> from eventsource_parser import parse
>>> event, rest = parse(source)
>>> event
Event(1, 'chat', 'hey, how are you?')
>>> rest
"id: 2\nevent: chat\ndata: fine, thank you\n\n:ping\n"
>>> event, rest = parse(rest)
>>> event
Event(2, 'chat', 'fine, thank you')
>>> rest
":ping\n"
>>> event, rest = parse(rest)
>>> event
None
>>> rest
""License
-------Licensed under the Apache License, Version 2.0.