pyAttention
A library to monitor information sources
Key Features
- Retrieves data from TCP servers, socketIO services, RSS feeds, and SQL databases
- Retrieves basic system data from linux-based computers (disk space, IP address, temperatures)
- Provides a queue interface for retrieving received information
- Supports polling and asynchronous monitoring
- Sources can be run individually or monitored together as a collection
- Sources run in their own thread or can share a thread across a collection
Installation
# Installation from pypi
pip pyAttention
# or
# Installation from github
$ git clone https://github.com/dhrone/pyAttention
# Install optional dependencies
# Databases
$ pip install sqlalchemy
$ pip install aiosqlite # For sqlite database support
$ pip install asyncpg # For PostgreSQL
$ pip install aiomysql # For mySQL
# RSS Feeds
$ pip install httpx lxml beautifulsoup4
# socketIO services
$ pip install python-socketio[client]==4.6.* aiohttp
# Local system data
$ pip install psutil netifaces
Quickstart
To retrieve data from a RSS feed
from pyAttention.source import rss
# EXAMPLE: Pull 3 day forecast of Manchester, UK from the BBC News RSS feed
url = 'https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2643123'
from pyAttention.source import rss
src = rss(url, frequency=21600) # Query feed every 6 hours
weather = src.get()
To retrieve data from a socketIO service
# EXAMPLE: monitor Volumio metadata from its socketIO API (see https://volumio.org)
from pyAttention.source import socketIO
url = 'http://localhost:3000'
src = socketIO(url)
async def callback(data):
await src.put(data)
src.subscribe('pushState', callback)
src.emit('getState') # Command needed to get Volumio to send a pushState message
state = src.get()
To retrieve data from a database
# EXAMPLE: pull data from a locally stored sqlite database
# Create test db
import sqlite3
con = sqlite3.connect('songs.db')
cur = con.cursor()
cur.execute('''CREATE TABLE songs (artist text, title text, album text)''')
cur.execute('''INSERT INTO songs VALUES ('Billie Eilish', 'bad guy', 'When We All Fall Asleep, Where Do We Go?')''')
cur.close()
from pyAttention.source import database
uri = 'sqlite+aiosqlite:///./songs.db'
src = database(uri, 'select * from songs')
songs = src.get()
Metadata
Release files for pyAttention 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyattention-0.1.3.tar.gz | 13.4 kB | Without provenance | Details for pyattention-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyattention-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pyattention-0.1.3-py3-none-any.whl |
Total release size: 27.3 kB
Release files / pyattention-0.1.3.tar.gz
| Download URL | pyattention-0.1.3.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd3dcd1149d7386367dca35dc6c12996f5516fa6d230da71bcb9978c54b83af5
|
|
BLAKE2b-256 checksum How to use checksums |
a9e16cf6a0dd5838e44b72234274a24948aaa00fff06a3abc95cb349ab7531b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
|
Release files / pyattention-0.1.3-py3-none-any.whl
| Download URL | pyattention-0.1.3-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd115c08f34e5a7b8a5411a42ed373e1b8d0d06c671b963ef99d8c65a259f3b6
|
|
BLAKE2b-256 checksum How to use checksums |
6ddf4a1070314a6b8f05e2e0ec00df8a33a95a5ad0a40f03eb6893d9bfaf0396
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
|
Security for pyAttention 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.