Page 309 -
P. 309
mobile app development
Test Drive
If it is not already running, start your web server and be sure to set the executable bit with the
chmod +x cgi-bin/generate_names.py command (if on Linux or Mac OS X). When you’re
ready, grab your favorite web browser and take your new CGI for a spin.
Enter the web address of the CGI in your
browser’s location bar.
Hey! It looks like the coach has
added two new athletes.
File Edit Window Help GeneratingJSON
$ python3 simple_httpd.py
Starting simple_httpd on port: 8080
The web server’s localhost - - [18/Sep/2010 06:31:29] "GET /cgi-bin/generate_names.py HTTP/1.1" 200 -
logging information localhost - - [18/Sep/2010 06:35:29] "GET /cgi-bin/generate_list.py HTTP/1.1" 200 -
confirms that the localhost - - [18/Sep/2010 06:35:35] "POST /cgi-bin/generate_timing_data.py HTTP/1.1" 200 -
CGI executed. localhost - - [18/Sep/2010 06:35:38] "GET /cgi-bin/generate_list.py HTTP/1.1" 200 -
localhost - - [18/Sep/2010 06:35:40] "GET /index.html HTTP/1.1" 200 -
localhost - - [18/Sep/2010 06:35:49] "GET /cgi-bin/generate_names.py HTTP/1.1" 200 -
That worked!
Now all you have to do is arrange for the Android emulator to request the
data within a Python script and display the list of names on the smartphone’s
screen. How hard can that be?
you are here 4 273