MENU

Fun & Interesting

Parsing data with Pydantic - A Python short by Michael Kennedy

Michael Kennedy 26,184 3 years ago
Video Not Working? Fix It Now

Quickly learn to use Pydantic to parse JSON data from a file or API. In just 5 minutes, you'll see how to take invalid data in JSON format, model it with Pydantic classes we create, and automatically detect errors and convert data to valid inputs when possible. Enjoy this Python short "quick hit" video by Michael Kennedy, a Python Software Fellow and host of the Talk Python To Me podcast. ▬ CODE ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Get the code for this video, and all my shorts, at https://talkpython.fm/shorts-code ▬ Chapters ▬▬▬▬▬▬▬▬▬▬▬▬ 0:00 - Introduction 0:21 - Your job: API developer 0:50 - What is Pydantic? 1:05 - The data we get with our "api" 2:17 - Modeling the data with classes 3:34 - Installing Pydantic 4:14 - Passing data to our Pydantic models 4:35 - Catching invalid data with Pydantic 5:20 - Seeing the validated and converted model result 7:08 - Conclusion ▬ More Videos ▬▬▬▬▬▬▬▬▬▬▬▬ Subscribe to the Python Shorts playlist by Michael at https://talkpython.fm/python-shorts to see all the topics we've covered. ▬ Dive deeper ▬▬▬▬▬▬▬▬▬▬▬▬ Listen to the Talk Python To Me podcast at https://talkpython.fm Check out our 100's of hours of Python courses at https://training.talkpython.fm/courses/all Follow Michael on Twitter at https://twitter.com/mkennedy

Comment