semvec/pypi-packages huggingface dataset:
sanic-sse 0.3.1
Sanic Server-Sent Events extension
License: MIT
Requires Python: >=3.5,<4.0

# Sanic Server-Sent Events extension

![Publish](https://github.com/inn0kenty/sanic_sse/workflows/Publish/badge.svg)

A Sanic extension for HTML5 [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) support, inspired by [flask-sse](https://github.com/singingwolfboy/flask-sse) and [aiohttp-sse](https://github.com/aio-libs/aiohttp-sse).

## Install

Installation process as simple as:

```bash
$ pip install sanic_sse
```

## Example

Server example:

```python
from http import HTTPStatus
from sanic import Sanic
from sanic.response import json, json_dumps
from sanic.exceptions import abort
from sanic_sse import Sse

# This function is optional callback before sse request
# You can use it for authorization purpose or something else
async def before_sse_request(request):
    if request.headers.get("Auth", "") != "some_token":
        abort(HTTPStatus.UNAUTHORIZED, "Bad auth token")


sanic_app = Sanic()

# The default sse url is /sse but you can set it via init argument url.
Sse(
    sanic_app, url="/events", before_request_func=before_sse_request
)  # or you can use init_app method


@sanic_app.route("/send", methods=["POST"])
async def send_event(request):
    # if channel_id is None than event will be send to all subscribers
    channel_id = request.json.get("channel_id")

    # optional arguments: event_id - str, event - str, retry - int
    # data should always be str
    try:
        await request.app.sse_send(json_dumps(request.json), channel_id=channel_id)
    except KeyError:
        abort(HTTPStatus.NOT_FOUND, "channel not found")

    return json({"status": "ok"})


if __name__ == "__main__":
    sanic_app.run(host="0.0.0.0", port=8000)
```

Client example (powered by [sseclient-py](https://github.com/mpetazzoni/sseclient) and [requests](https://github.com/requests/requests)):

```python
import json
import pprint
import requests
import sseclient

url = "http://127.0.0.1:8000/events"
# you may set channel_id parameter to receive special events
# url = "http://127.0.0.1:8000/events?channel_id=foo"

response = requests.get(url, stream=True)
client = sseclient.SSEClient(response)
for event in client.events():
    print(event.id)
    print(event.event)
    print(event.retry)
    pprint.pprint(json.loads(event.data))
```

## Requirements

- [python](https://www.python.org/) 3.5+
- [sanic](https://github.com/channelcat/sanic) 0.7.0+
py2sqlite3 0.19
py2sqlite3 is a library that facilitates the communication between python objects and sqlite3 databases.
License: MIT
Requires Python: >=3.6
Keywords: orm,sql,sqlite3,,C#,lexical analysis,parsing

#Py2sqlite3
____

Py2sqlite3 is a library that facilitates the communication between python objects and sqlite3 databases

____

## Installation

https://pypi.org/project/py2sqlite3/

`pip install py2sqlite3`
____

## Command line usage (only to run test):

python -m py2sqlite3

____

## Usage as library

### Example

```
from py2sqlite3 import Py2sqlite3

class Foo:
    bar = 0

class Foo2(Foo):
    pass

py2sql = Py2sqlite3()

py2sql.db_connect('test.db')
py2sql.save_class(Foo)              # saves class Foo
py2sql.save_class_hierarchy(Foo)    # saves Foo and Foo2
py2sql.save_object(Foo())           # saves object of class Foo

py2sql.delete_class(Foo)            # deletes class Foo
py2sql.delete_class_hierarchy(Foo)  # deletes Foo and Foo2
py2sql.delete_object(Foo())         # deletes object of class Foo

py2sql.db_disconnect()
```
iOSpy 0.2.0
iOS MobileSync backup data extraction
License: MIT
Requires Python: >=3.6

# `iOSpy` <img align="right" src="https://badge.fury.io/py/iOSpy.svg">

`iOSpy` is a Python package for extracting data from iOS MobileSync backups.

It uses the namespace `iospy` and provides a command line tool, `ios`.

Install from [PyPI](https://pypi.org/project/iOSpy/):

```sh
pip install iOSpy
```

Then get started with the CLI:

```sh
ios --help
```


## License

Copyright 2018–2020 Christopher Brown.
[MIT Licensed](https://chbrown.github.io/licenses/MIT/#2018-2020).