Search⌘ K
AI Features

Choose an Appropriate Library

Explore the criteria for selecting an appropriate Python library to consume REST APIs effectively. Understand the differences between low-level and high-level HTTP libraries, and discover why the requests library suits most needs for both simple and configurable API consumption.

We'll cover the following...

Before we start creating a client to consume REST services, we need to select the Python library that we’re going to use.

First of all, we need to define what we need the library to do. Then, after looking at the available Python libraries, we’ll be able to select the best match for our requirements. So, let’s first specify the selection criteria.

Python
Python

Our criteria

There are many libraries in every language that can be used to access a service, ranging from low-level TCPTransmission Control Protocol access-based libraries at one end to very high-level libraries at the other end that abstract out all the connection-related details. So, let’s define our requirements and conditions for choosing a library. What we need is a library with the following features:

  1. It should abstract out the low-level connection details.
  2. It should allow us to directly access/use the lower HTTP layers if required.
  3. If point 2 isn’t possible, then the library should at least let
...