Book Image

Python Network Programming

By : Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
Book Image

Python Network Programming

By: Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker

Overview of this book

This Learning Path highlights major aspects of Python network programming such as writing simple networking clients, creating and deploying SDN and NFV systems, and extending your network with Mininet. You’ll also learn how to automate legacy and the latest network devices. As you progress through the chapters, you’ll use Python for DevOps and open source tools to test, secure, and analyze your network. Toward the end, you'll develop client-side applications, such as web API clients, email clients, SSH, and FTP, using socket programming. By the end of this Learning Path, you will have learned how to analyze a network's security vulnerabilities using advanced network packet capture and analysis techniques. This Learning Path includes content from the following Packt products: • Practical Network Automation by Abhishek Ratan • Mastering Python Networking by Eric Chou • Python Network Programming Cookbook, Second Edition by Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
Table of Contents (30 chapters)
Title Page
Copyright
About Packt
Contributors
Preface
Index

Throttling requests with RequestsThrottler


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.

Getting ready

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...