RESTful APIs with the Pyramid Web Framework Course

Course Summary

Whether you're adding an API to an existing web application, creating a new API for a JavaScript heavy client-side app, or even building a backend service for a mobile app, this course will show you how to build RESTful services using Pyramid and integrate with a real database over SQLAlchemy.

What students are saying

Thanks for your podcasts and courses. It’s all been very helpful. Just wanted to let you know that I got a job with a startup. Looking forward to working with Python and even doing some ML. Very exciting stuff. Keep up the great work!
-- Pat

Source code and course GitHub repository

github.com/mikeckennedy/restful-services-in-pyramid

What's this course about and how is it different?

This course will teach you how to build RESTful and HTTP-based services in Python using the Pyramid web framework.

Yes, you will learn the necessary programming techniques. But we will go much deeper than just stringing together some methods in your web framework. In this course, you will

  • Compare RESTful services to other services such as SOAP and sockets
  • Fully understand how to leverage HTTP verbs, status codes, content types, and URLs to properly design and deliver RESTful services
  • Add JSON, CSV, image, and other response types to services
  • Explore and test your services using the Postman application
  • Add content negotiation to allow clients to select the best response type
  • Properly refactor your service code for maintainability using view models and more
  • Work with SQLAlchemy as the backend for your web services
  • Deploy your HTTP service for production behind NGINX and uWSGI

View the full course outline.

Who is this course for?

Anyone who knows Python and would like to use Python to create flexible and high performance RESTful or HTTP-based web services.

Whether you need a backend for your mobile app, rich JavaScript app, or want add an API to your existing Pyramid web application, this course will teach you the concepts as well as the programming techniques to implement them.

What will you learn in this course?

Some topics covered include.

  • Setting up Python 3, Postman, and PyCharm for local development
  • The concepts and principles of RESTful services
  • Key building blocks of the Pyramid web framework
  • Building a comprehensive service using HTTP verbs, status codes, content types, and more
  • Adding content negotiation to services
  • Enforce identity and authorization using API keys
  • How to call your service from Python and from JavaScript
  • Add CORS support for cross-site access
  • The basics of SQLAlchemy for backing our services with a database
  • How to add logging and production-time monitoring of errors
  • Deploying your service on Linux behind NGINX and uWSGI for a full production capable deployment

View the full course outline.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can lose the forest for the trees. That's why when we hit a new topic, we stop and discuss it with concise and clear visuals.

Here's an example for when we first introduce the use-cases of HTTP services.

Example: Concepts backed by concise visuals

Follow along with subtitles and transcripts

Each course comes with subtitles and full transcripts. The transcripts are available as a separate searchable page for each lecture. They also are available in course-wide search results to help you find just the right lecture.

Each course has subtitles available in the video player.

Who am I? Why should you take my course?

Who is Michael Kennedy?

My name is Michael, nice to meet you. ;) There are a couple of reasons I'm especially qualified to teach you Python.

 1. I'm the host of the #1 podcast on Python called Talk Python To Me. Over there, I've interviewed many of the leaders and creators in the Python community. I bring that perspective to all the courses I create.

 2. I've been a professional software trainer for over 10 years. I have taught literally thousands of professional developers in hundreds of courses throughout the world.

 3. Students have loved my courses. Here are just a few quotes from past students of mine.

"Michael is super knowledgeable, loves his craft, and he conveys it all well. I would highly recommend his training class anytime." - Robert F.
"Michael is simply an outstanding instructor." - Kevin R.
"Michael was an encyclopedia for the deep inner workings of Python. Very impressive." - Neal L.

Free office hours keep you from getting stuck

One of the challenges of self-paced online learning is getting stuck. It can be hard to get the help you need to get unstuck.

That's why at Talk Python Training, we offer live, online office hours. You drop in and join a group of fellow students to chat about your course progress and see solutions via screen sharing.

Just visit your account page to see the upcoming office hour schedule.

Is this course based on Python 3 or Python 2?

This course is based upon Python 3. Python 2 is officially unsupported as of January 1st, 2020 and we believe that it would be ill-advised to teach or learn Python 2. This course is, and has always been, built around Python 3.

The time to act is now

Go beyond just learning how to build RESTful services. Deeply understand them and build better services.

Course Outline: Chapters and Lectures

Welcome to the course
8:44
The power of APIs
6:39
Video player: A quick feature tour
2:05
Course setup and tools
16:13
Course requirements and tools
3:09
Setup on macOS
3:49
Setup on Windows
4:08
Setup on Linux (Ubuntu)
5:07
What is REST?
30:04
Introduction to RESTful services
5:18
HTTP verbs
3:30
HTTP status codes
5:40
Example service: GitHub
3:07
Example service: Basecamp
3:37
Comparing REST/HTTP services to other service types
8:52
Web application building blocks
21:41
Python web frameworks
4:13
Pyramid building blocks
3:29
Pyramid building block: Views
3:55
Pyramid building block: Routes
3:35
Pyramid building block: Config
2:39
Pyramid building block: Models
1:21
Pyramid building block: Templates
2:29
Your first service
41:10
Introducing the car dealer service
1:50
Creating the web app
5:54
Running in pycharm
3:31
Concept: Creating the site
3:16
Project structure
2:37
Reorganizing the project for APIs
6:48
Implementing the API
4:20
Adding data
9:54
Concepts: Implement the API
3:00
Calling services with Python and JavaScript
29:20
Calling services with Postman
5:11
Calling services with Python clients
7:37
Calling services with JavaScript clients
6:17
Enabling cross-domain requests with CORS
10:15
A nearly RESTful service
49:13
A nearly RESTful service introduction
5:19
Creating cars, RESTfully
9:28
Concept: RESTfully creating cars
3:24
Updating cars, RESTfully
8:39
Concept: RESTfully updating cars
1:47
Deleting cars, RESTfully
2:58
Concept: Deleting cars, RESTfully
1:25
Introducing renderers
3:33
The problem: JSON renderer for custom types
1:36
Extending JSON renderer for custom types
8:46
Concept: JSON renderer for custom types
2:18
Customer Renderers
49:16
Introduction to renderers
3:39
Adding a CSV renderer
11:05
Generating both CSV and JSON responses
1:51
Adapting non-standard types
11:15
Generating image-based responses with renderers (v1)
8:18
Generating image-based responses with renderers (v2)
5:27
Common renderer types via ABCs (abstract base classes)
3:36
Adding the JSON renderer to the ABCs (abstract base classes)
4:05
Content negotiation
27:54
What is content negotiation?
1:48
Adding a negotiating renderer
16:14
Realistic accept headers
6:28
Concept: Negotiating renderer
3:24
Validation with view models
28:27
Adding validation to APIs (never trust input)
5:11
Concept: Adding validation to APIs
1:54
Moving validation to view models
9:56
Improved car object creation
7:13
View model classes
2:13
Concept: View models
2:00
Adding a database backend with SQLAlchemy
43:54
Introducing SQLAlchemy
3:01
Getting started SQLAlchemy
2:16
Database sessions
3:05
Unit of work and the session factory
5:08
Modeling classes
8:02
Creating tables
2:36
Updating the repository to use SQLAlchemy
12:08
Concept: SQLAlchemy building blocks
7:38
Authenticated services
25:47
Setting up users
6:29
Creating a few users
2:43
Passing the API key
6:28
Isolating the API auth features
7:29
Authorization concepts
2:38
Logging and monitoring
33:08
Why you want monitoring and logging
3:33
Introducing logbook
1:02
Setting up logbook
7:22
Using logbook
14:39
Exploring Rollbar for real-time monitoring
6:32
Deploying your REST service to DigitalOcean on Ubuntu
36:56
How we deploy Python on nginx, uWSGI, and Ubuntu
2:43
DigitalOcean overview
3:38
Creating your ssh key
1:15
Create and configuring the droplet (server)
11:49
Configure uWSGI
4:30
Configuring nginx
9:39
Concepts: Deployment
3:22
Documenting your API
10:50
Documentation options
2:46
Adding the documentation views
4:59
The documentation HTML and CSS
3:05
Conclusion
16:42
You've done it!
1:22
Lightning review: What is REST?
1:13
Lightning review: Web building blocks
1:22
Lightning review: Creating the service
1:53
Lightning review: API view methods
1:22
Lightning review: Content negotiation
1:31
Lightning review: View models
1:50
Lightning review: SQLAlchemy
1:06
Lightning review: API keys
1:25
Lightning review: Logging and monitoring
1:01
Lightning review: Deployment
1:25
Lightning review: Docs
0:42
Thanks and bye
0:30
Buy for $59 + tax Bundle and save 85% Team Gift

Questions? Send us an email: contact@talkpython.fm

Talk Python's Mastodon Michael Kennedy's Mastodon