Networks need to have accounting in addition to authorization and authentication. Accounting ensures proper use of the resources, this means that everyone gets to use the services in a fair manner. Network throttling enables accounting in the web services. This is a simple recipe that offers a throttling service to the web requests.
We use requests_throttler
Python module to throttle the web requests. First, install the module and configure our recipe using the following script:
$ sh 20_10_requests_throttling.sh#!/bin/bash##################################################### Python Network Programming Cookbook, Second Edition -- Chapter - 11##################################################### Download and extract RequestsThrottlerwget https://pypi.python.org/packages/d5/db/fc7558a14efa163cd2d3e4515cdfbbfc2dacc1d2c4285b095104c58065c7/RequestsThrottler-0.1.0.tar.gztar -xvf RequestsThrottler-0.1.0.tar.gzcd RequestsThrottler-0.1.0# Copy...