Chapter 9. Web Services

In Chapter 8, we showed how you can use PyS60 to build network clients and servers of your own. In this chapter, we show how to tap into services provided by others. These two approaches are becoming more and more complementary. Often the most interesting results emerge when you combine something of your own, such as your current location, with some external information, such as Google Maps.

Information available in ordinary websites is primarily prepared for human consumption. Data is embedded in elaborate visual layouts that look pleasing to the eye but from which it is difficult to extract the data programmatically. Technically, it would be possible to retrieve any web page using, for example, the urllib.urlopen() function but parsing the desired data from the midst of complex HTML code is a tedious and error-prone task. Luckily, some Python libraries, such as Beautiful Soup, exist to make this task easier.

However, many websites and web application providers have understood that they can increase the value of their product by making it easily accessible to other programs, as well as human users. Increasingly often, they are starting to provide another view to their service that can be used to retrieve the pure data easily without any decoration. This interface is often called a web service or a web Application Programming Interface (web API).

For example, Amazon, Google, Yahoo!, Flickr, Facebook and most of the blog engines provide a web API through ...

Get Mobile Python: Rapid Prototyping of Applications on the Mobile Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.