Python Web Service Example

Introduction

I was testing a client software which communicates with a server software using JSON format. The behavior of the client depends on the instructions specified in the server response. In order to test the client I had to modify the server response and try different scenarios. One way to change the server response is to use the server web interface. This works but it is slow and inconvenient. Another way is to install a web proxy such as Charles and intercept HTTP requests, modify the request on the fly then pass back to client. This also works fine but it is not convenient as well. In this short article I will describe an easy and convenient way to achieve that goal

Solution

1. Install web.py module using the following command…

2. Below is the server code that uses web.py

Add a Comment

Your email address will not be published. Required fields are marked *