Opoint Python Client
The is a client library for interacting with Opoint products.
Initially supports Safefeed.
Installation
Choose at least one of the web request backends, asyncio or requests
pip install opoint[aio]
# OR
pip install opoint[requests]
# OR
pip install opoint[aio,requests]
Safefeed
The Safefeed client comes in two versions, one using asyncio and aiohttp, and one using requests.
Asyncio example:
from opoint.safefeed.aio import SafefeedClient
# Using as an iterator
async with SafefeedClient("your-token-here") as client:
async for batch in client:
my_process_batch(batch)
# "Manual" usage
async with SafefeedClient("your-token-here") as client:
while True:
batch = await client.get_articles()
my_process_batch(batch)
Requests example:
from opoint.safefeed.sync import SafefeedClient
client = SafefeedClient("your-token-here")
for batch in client:
my_process_batch(batch)
By default, the safefeed client will attempt to make smart decisions about how often to poll the feed and how many articles to ask for based on observed rate of new articles.
If you have any additional requirements, you can customise the parameters interval, num_art, and expected_rate. Unset parameters are adjusted based on observations and the specified parameters. If you set all three of these, all adaptive behaviour will cease. Don't do this unless you are confident in your parameters.
The interval setting sets the actual interval from the start of one request to the start of the next. The program sleeps the remaining time once the next iteration is called.
It is recommended that the batch processing is short, preferably no more than a few seconds even for a full feed, otherwise the interval might be missed. This means you likely want to simply hand the batch off to a thread, put in in a queue, or otherwise do the actual processing either in a different thread or a different program, such that it does not block the feed. For sparse feeds that are called more rarely and have fewer hits this is not a concern.
Metadata
Release files for opoint 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opoint-0.1.2.tar.gz | 41.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opoint-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.7 kB
Release files / opoint-0.1.2.tar.gz
| Download URL | opoint-0.1.2.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
862736d3073c360435d24dc0859e69481cfa7fb6de758a425efe321c02d023a4
|
|
BLAKE2b-256 checksum How to use checksums |
592f554a370e85efde1dc03c25a4844c7e8f156e27c50cfdb3d67245e779a955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.11
|
Release files / opoint-0.1.2-py3-none-any.whl
| Download URL | opoint-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
150213358812b783e12fac84eff79b36e8a2d1e7222bae60f50c2555bd5553d9
|
|
BLAKE2b-256 checksum How to use checksums |
1429ff8427d754a3b91833db0df237e1f120e5bbe6add07d9ee40ee2d5036581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.11
|