In this session, Brian and chat learn about decorators with Flask as they build out an API in Python. They started off by getting stuck on an issue with recreating the same environment from past sessions but work through it and fix the install script. They finish up by successfully implementing a decorator that checks if the request to the API has been authenticated.
The following are notes and details recapping a past live stream where we live code together. The idea behind these streams is that they provide real-world examples of running into problems and solving them or working towards solving them live. Enjoy this latest one on Python 🙂👍
- ✔ Warm up/Catch up with chat
- ✔ Learn about Decorators in Python
- ✔ Closing and raid @GarethHubball
- Fixed an issue with the environment installation script to make sure our project can be setup and run easily
- Learned about decorators
- Learned about the build in Session class available in Flask
- Created our own decorator to protect an API endpoint
- Project Repo
- Visual Studio Online Configuration
- VS Code Containers Documentation
- GitHub CLI Tool
- Python Cheat Sheet
- Microsoft Developer's Python for Beginners
Clips are a feature on Twitch that let you cut and capture segments of the live stream in the moment (up to 60 seconds). See how to use clips on Twitch for more details. The following are some fun moments captured from this stream:
Links not working on Twitch? It's most likely because Twitch will only save my stream recordings for about 60 days. Use the YouTube link at the top of this page instead.
This table helps point out different segments of the stream (highlighted in bold) or moments we learned something (not bold). The timestamps link to the video on Twitch at that point in the recording. If you'd like the YouTube link above will have similar timestamps and link to those same points in the recording as well.
|00:04:15||Stream is back and we're moving into the Python stuffs|
|00:07:05||Reading/learning about view decorators in Flask|
|00:08:38||View Decorators (created by @murgmasallam)|
|00:12:09||Authentication vs. authorization discussion|
|00:19:50||Environment setup (created by @GarethHubball)|
|00:40:25||Looking at decorators (created by @GarethHubball)|
|00:45:31||Debugging the container (created by @GarethHubball)|
|01:37:23||Finish fixing the environment and now moving on to the login decorator again|
|03:23:28||Checking in changes by forking repo (created by @codesillystuff)|
|03:28:45||Closing and raid|
Thanks for reading this article. If you're interested in finding more content from Microsoft Cloud Advocates check out this monthly curated newsletter: Developer Community Newsletter
The software industry moves fast. But if you keep up, you can have an incredible career.
As software gets more and more integrated into our lives, the industrialization of its crafting process becomes inevitable. But the over-generalization of software engineering can be crushing the creative side of programming.