Skip to main content

Client library for Opoint products

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opoint-0.1.2.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opoint-0.1.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file opoint-0.1.2.tar.gz.

File metadata

  • Download URL: opoint-0.1.2.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.11

File hashes

Hashes for opoint-0.1.2.tar.gz
Algorithm Hash digest
SHA256 862736d3073c360435d24dc0859e69481cfa7fb6de758a425efe321c02d023a4
MD5 9c593a320516052402b97fa5ea584337
BLAKE2b-256 592f554a370e85efde1dc03c25a4844c7e8f156e27c50cfdb3d67245e779a955

See more details on using hashes here.

File details

Details for the file opoint-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: opoint-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.11

File hashes

Hashes for opoint-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 150213358812b783e12fac84eff79b36e8a2d1e7222bae60f50c2555bd5553d9
MD5 118421f13005fcd7b81a13c250d8abfe
BLAKE2b-256 1429ff8427d754a3b91833db0df237e1f120e5bbe6add07d9ee40ee2d5036581

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page