The Rate-Limited Queue

class rate_limited_queue.RateLimitedQueue(items, processing_function, rate_limits)[source]

Takes a list of items to be processed, along with a function with which to process them, and a list of RateLimit objects.

Parameters:
  • items (list or other iterable) – Items to be processed.
  • processing_function (function) – The function to call when processing an item.
  • rate_limits (list or other iterable) – One or more RateLimit objects.
process()[source]

Processes the list of items via application of processing_function, but without violating any of the rate_limits.

Return type:list of processed items