Skip to main content

A queue that allows for processing of items within one or more rate-limits.

Project description

A Queue That Respects Rate Limits.

The original prototype for this code was written to rate-limit calls to a geocoding api via geopy.

import geopy

from rate_limited_queue import RateLimitedQueue, RateLimit

addresses = open("some_file_of_addresses.txt").read().splitlines()

# No more than ten addresses geocoded per second
rate_limit = RateLimit(duration=1, max_per_interval=10)

geocoder = geopy.geocoder.OpenMapQuest()

q = RateLimitedQueue(
                    processing_function = geocoder.geocode,
                    rate_limits = [rate_limit])

# Grabs the geocoded locations, but doesn't process
# more than ten per second
geocoded_locations = q.process()

Check out the docs for more information.


It’s up on PyPI, so just do a:

pip install rate_limited_queue


sudo pip install rate_limited_queue

Project details

Download files

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

Files for rate_limited_queue, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size rate_limited_queue-0.0.6.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page