Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frizensami/streamlimit-utils
Stream limiting functions
https://github.com/frizensami/streamlimit-utils
Last synced: 27 days ago
JSON representation
Stream limiting functions
- Host: GitHub
- URL: https://github.com/frizensami/streamlimit-utils
- Owner: frizensami
- Created: 2020-10-02T08:44:40.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T04:07:23.000Z (almost 4 years ago)
- Last Synced: 2023-08-03T20:39:37.132Z (over 1 year ago)
- Language: Python
- Size: 28.3 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stream Limiting Utils
Quick-and-dirty utils for limiting a row-generating function to simulate a stream of data.
Two types of stream limiting:
- Off-the-shelf limiting library
``` python
def construct_ratelimit_rows(row_generator_fx, max_rows_per_minute, blocking=True):
```- Generic rate limiter that calls functions to find amount of rows to return and sleep time
``` python
def construct_generic_limited_rows(row_generator_fx, rows_function, sleep_function):
```For the latter, there are util functions to make life easier. E.g., for a random interval:
``` python
def construct_randomsleep_rows(row_generator_fx, min_sleep, max_sleep, rows=1):
```