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[asyncio]
# OR
pip install opoint[requests]
# OR
pip install opoint[asyncio,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.0.tar.gz (38.5 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.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for opoint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 752f762e0490198b6230e1a537aa455391f4c087bb44f2c33b97022bac1df1fc
MD5 e8de48467ab17ba9d938641153cbaf35
BLAKE2b-256 2a876d012cbfcdbdea564bf72a38fc203f406988ebe7c87fb2f0b09a6bf41054

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for opoint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51e19768c71b55fff8f64dcb34c73f5c0a0cef4905a2dc9f1a67801e8cffea2c
MD5 6201081f15224b983d5bb8d0ddd74a51
BLAKE2b-256 b28eae39e4d156021f62bd9d8ea75bc1143ba554ec1e3cad8466cc60cdd58539

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