Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On RESTful Python Web Services

You're reading from   Hands-On RESTful Python Web Services Develop RESTful web services or APIs with modern Python 3.7

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher
ISBN-13 9781789532227
Length 500 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Gaston C. Hillar Gaston C. Hillar
Author Profile Icon Gaston C. Hillar
Gaston C. Hillar
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Developing RESTful APIs and Microservices with Flask 1.0.2 FREE CHAPTER 2. Working with Models, SQLAlchemy, and Hyperlinked APIs in Flask 3. Improving Our API and Adding Authentication to it with Flask 4. Testing and Deploying an API in a Microservice with Flask 5. Developing RESTful APIs with Django 2.1 6. Working with Class-Based Views and Hyperlinked APIs in Django 2.1 7. Improving Our API and Adding Authentication to it with Django 8. Throttling, Filtering, Testing, and Deploying an API with Django 2.1 9. Developing RESTful APIs with Pyramid 1.10 10. Developing RESTful APIs with Tornado 5.1.1 11. Working with Asynchronous Code, Testing, and Deploying an API with Tornado 12. Assessment 13. Other Books You May Enjoy

What this book covers

Chapter 1, Developing RESTful APIs and Microservices with Flask 1.0.2, begins working with Flask and its Flask-RESTful extension. We will create a RESTful Web API that performs CRUD (short for Create, Read, Update, and Delete) operations on a simple list.

Chapter 2, Working with Models, SQLAlchemy, and Hyperlinked APIs in Flask, expands the capabilities of the RESTful API that we started in the previous chapter. We will use SQLAlchemy as our ORM to work with a PostgreSQL database and we will take advantage of advanced features included in Flask and Flask-RESTful that will allow us to easily organize code for complex APIs, such as models and blueprints.

Chapter 3, Improving Our API and Adding Authentication to it with Flask, improves the RESTful API in many ways. We will add user-friendly error messages when resources aren't unique. We will test how to update single or multiple fields with the PATCH method and we will create our own generic pagination class. Then, we will start working with authentication and permissions. We will add a user model and update the database. We will make many changes in the different pieces of code to achieve a specific security goal, and we will take advantage of Flask-HTTPAuth and passlib to use HTTP authentication in our API.

Chapter 4, Testing and Deploying an API in a Microservice with Flask, explains how to set up a testing environment. We will install pytest and the necessary plugins to make it easy to discover and execute unit tests, and we will create a new database to be used for testing. We will write a first round of unit tests, measure test coverage, and then write additional unit tests to improve test coverage. Finally, we will learn many considerations for deployment, scalability, and the execution of a Flask RESTful API within a microservice on the cloud.

Chapter 5, Developing RESTful APIs with Django 2.1, shows how to start working with Django and Django REST Framework, and we will create a RESTful Web API that performs CRUD operations on a simple SQLite database.

Chapter 6, Working with Class-Based Views and Hyperlinked APIs in Django 2.1, expands the capabilities of the RESTful API that we started in the previous chapter. We will change the ORM settings to work with a more powerful PostgreSQL 10.5 database and we will take advantage of advanced features included in Django REST Framework that allow us to reduce boilerplate code for complex APIs, such as class-based views.

Chapter 7, Improving Our API and Adding Authentication to it with Django, improves the RESTful API that we started in the previous chapter. We will add unique constraints to the model and update the database. We will make it easy to update single fields with the PATCH method and we will take advantage of pagination. We will start working with authentication, permissions, and throttling.

Chapter 8, Throttling, Filtering, Testing, and Deploying an API with Django 2.1, takes advantage of many features included in Django REST Framework to define throttling policies. We will use filtering, searching, and ordering classes to make it easy to configure filters, search queries, and the desired order for the results in HTTP requests. We will use the Browsable API feature to test these new features included in our API. We will write a first round of unit tests, run them with pytest, and then write additional unit tests to improve test coverage. Finally, we will learn many considerations for running Django RESTful APIs on the cloud.

Chapter 9, Developing RESTful APIs with Pyramid 1.10, works with Pyramid combined with other useful packages to create a RESTful Web API. We will design a RESTful API to interact with a simple data source. We will define the requirements for our API and we will understand the tasks performed by each HTTP method. We will create the class that represents a surfboard metric and we will use marshmallow to validate, serialize, and deserialize the model. We will write functions to process the different HTTP request methods and we will configure the view handlers.

Chapter 10, Developing RESTful APIs with Tornado 5.1.1, works with Tornado to create a RESTful Web API. We will design a RESTful API to interact with slow sensors and actuators. We will define the requirements for our API and we will understand the tasks performed by each HTTP method. We will create the classes that represent a drone and write code to simulate slow I/O operations that are called for each HTTP request method. We will write classes that represent request handlers and process the different HTTP requests and configure the URL patterns to route URLs to request handlers and their methods.

Chapter 11, Working with Asynchronous Code, Testing, and Deploying an API with Tornado, explains the difference between synchronous and asynchronous execution. We will create a new version of the RESTful API that takes advantage of the non-blocking features in Tornado combined with asynchronous execution. We will improve scalability for our existing API and we will make it possible to start executing other requests while waiting for the slow I/O operations with sensors and actuators. Then, we will set up a testing environment. We will install pytest to make it easy to discover and execute unit tests. We will write a first round of unit tests, measure test coverage, and then write additional unit tests to improve test coverage.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime