Application Programming Interface in Action

When we talk about APIs in relation to Python, we usually refer to the classes and the functions that a module presents to us for interact action. In this chapter, we'll be talking about something different, that is, web APIs.

A web API is a type of API that you interact with through the HTTP protocol. Nowadays, many web services provide a set of HTTP calls, which are designed to be used programmatically by clients; they are meant to be used by machines rather than by humans. Through these interfaces, it's possible to automate interaction with the services and to perform tasks such as extracting data, configuring the service in some way, and uploading your own content to the service.

The following topics will be covered in this chapter:

  • Introduction to REST APIs
  • Introduction to JSON and the json module
  • Interacting with a JSON hybrid-REST API (Twitter)
  • Introduction to XML
  • Working with XML and a full REST API (Amazon S3 bucket) with the Boto module

You will learn how to use Python to extract data from the major data formats found on the web: HTML, XML, and JSON. An example of pulling useful information from a downloaded web page will be used to illustrate HTML, while interactions with REST APIs will be used to guide you through the essentials of working with XML and JSON.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset