Book Image

Learning Python Network Programming

By : Dr. M. O. Faruque Sarker, Samuel B Washington, Sam Washington
Book Image

Learning Python Network Programming

By: Dr. M. O. Faruque Sarker, Samuel B Washington, Sam Washington

Overview of this book

Table of Contents (17 chapters)
Learning Python Network Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 3. APIs 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 to interact with. 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, that is, 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 into the service.

In this chapter, we'll look at:

  • Two popular data exchange formats used by web APIs: XML and JSON

  • How to interact with two major web APIs: Amazon S3 and Twitter

  • How to pull data from HTML pages when an API is not available

  • How to make life easier for the webmasters that provide these...