title
REST API Crash Course - Introduction + Full Python API Tutorial

description
Start your software dev career - https://calcur.tech/dev-fundamentals 💯 FREE Courses (100+ hours) - https://calcur.tech/all-in-ones 🐍 Python Course - https://calcur.tech/python-courses Timestamps: 00:00 - Introduction 05:15 - API App example 09:15 - Why an API is important 15:00 - HTTP methods 16:45 - POST vs PUT 20:56 - Consume the StackOverflow API 27:44 - Setting up our own Python API 31:13 - GET request setup 32:04 - Database model setup for SQLAlchemy 39:10 - GET data with query.all 41:56 - GET data by ID with parameter 44:19 - Developer tools network Intro 45:03 - POST a new record 47:15 - Postman Introduction 49:21 - DELETE data 51:46 - Conclusion ✅ Data Structures & Algorithms - https://calcur.tech/dsa-youtube ~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~ ✉️ Newsletter - https://calcur.tech/newsletter 📸 Instagram - https://www.instagram.com/CalebCurry 🐦 Twitter - https://twitter.com/calebCurry 🔗 LinkedIn - https://www.linkedin.com/in/calebcurry ▶️ Subscribe - http://calcur.tech/subscribe 👨🏻‍🎓 Courses - https://www.codebreakthrough.com ~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~ ↪ My Amazon Store - https://www.amazon.com/shop/calebcurry 🅿 Patreon - http://calcur.tech/patreon-calebcurry 🅖 GitHub Sponsors - https://github.com/sponsors/CalebCurry Ⓟ Paypal - http://paypal.me/calcur 🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq 🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853 📈 Buy Bitcoin - https://calcur.tech/crypto Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code "Caleb") - https://calcur.tech/crypto #python

detail
{'title': 'REST API Crash Course - Introduction + Full Python API Tutorial', 'heatmap': [{'end': 1279.067, 'start': 1243.729, 'weight': 0.874}, {'end': 1658.962, 'start': 1618.226, 'weight': 0.763}, {'end': 1721.737, 'start': 1681.243, 'weight': 0.78}, {'end': 1846.318, 'start': 1808.393, 'weight': 1}], 'summary': "A comprehensive tutorial on rest api basics, backend versatility benefits, server data request methods, data management in python, creating python api with flask and sqlalchemy, and python rest api creation, emphasizing practical examples and concepts such as idempotency, query parameters, 'requests' library, and database setup.", 'chapters': [{'end': 316.55, 'segs': [{'end': 39.321, 'src': 'embed', 'start': 0.089, 'weight': 0, 'content': [{'end': 3.19, 'text': 'hey, everyone, welcome to your rest api crash course.', 'start': 0.089, 'duration': 3.101}, {'end': 4.03, 'text': 'my name is caleb.', 'start': 3.19, 'duration': 0.84}, {'end': 8.112, 'text': "in this video we're going to talk about everything you need to know to get started with rest apis.", 'start': 4.03, 'duration': 4.082}, {'end': 10.013, 'text': "we're going to first talk about the concepts,", 'start': 8.112, 'duration': 1.901}, {'end': 16.415, 'text': "then we're going to talk about how to consume an api and then we're going to build our very own api in python.", 'start': 10.013, 'duration': 6.402}, {'end': 20.137, 'text': "so it's a lot of useless or it's a lot of useful information.", 'start': 16.415, 'duration': 3.722}, {'end': 25.279, 'text': 'so if you need a reference of all this, i created a pdf that you guys can get for free with a link in the description.', 'start': 20.137, 'duration': 5.142}, {'end': 26.979, 'text': 'so go check that out.', 'start': 25.859, 'duration': 1.12}, {'end': 31.28, 'text': 'if you just need to, like you know, look at the definitions and study or whatever.', 'start': 26.979, 'duration': 4.301}, {'end': 39.321, 'text': "but anyways, we're going to jump in by first talking about what a rest api is, why you should care and where this is used in software.", 'start': 31.28, 'duration': 8.041}], 'summary': 'Caleb provides a crash course on rest apis, covering concepts, consumption, and python-based api creation.', 'duration': 39.232, 'max_score': 0.089, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo89.jpg'}, {'end': 118.417, 'src': 'embed', 'start': 89.094, 'weight': 3, 'content': [{'end': 91.675, 'text': "That's where an API is going to come in and save the day.", 'start': 89.094, 'duration': 2.581}, {'end': 96.316, 'text': "It allows different applications that aren't built exactly the same to communicate.", 'start': 91.755, 'duration': 4.561}, {'end': 99.037, 'text': "So we'll say this one was built in Python.", 'start': 97.136, 'duration': 1.901}, {'end': 102.831, 'text': 'and this one was built in JavaScript.', 'start': 100.47, 'duration': 2.361}, {'end': 104.372, 'text': "Poor developer, I'm so sorry.", 'start': 103.031, 'duration': 1.341}, {'end': 113.675, 'text': 'Well, an API allows us to build functionality in this application, to make a request to this other application,', 'start': 104.512, 'duration': 9.163}, {'end': 118.417, 'text': 'and then this application can give a response back to this application.', 'start': 113.675, 'duration': 4.742}], 'summary': 'Api enables different applications to communicate, regardless of their programming language, providing flexibility and interoperability.', 'duration': 29.323, 'max_score': 89.094, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo89094.jpg'}, {'end': 194.975, 'src': 'embed', 'start': 165.317, 'weight': 4, 'content': [{'end': 172.58, 'text': 'So JSON is a language or a notation of describing information.', 'start': 165.317, 'duration': 7.263}, {'end': 178.042, 'text': "It's just like text, and it stands for JavaScript Object Notation.", 'start': 173.201, 'duration': 4.841}, {'end': 184.347, 'text': "So it's a way to notate what objects look like, but it doesn't have to be done with JavaScript.", 'start': 178.503, 'duration': 5.844}, {'end': 190.532, 'text': "It's actually supported in pretty much every language, and this is now the standard for APIs.", 'start': 184.787, 'duration': 5.745}, {'end': 194.975, 'text': 'You may run into APIs that use XML.', 'start': 191.152, 'duration': 3.823}], 'summary': 'Json is a universal notation for objects, supported by many languages and the standard for apis.', 'duration': 29.658, 'max_score': 165.317, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo165317.jpg'}, {'end': 295.031, 'src': 'embed', 'start': 267.25, 'weight': 5, 'content': [{'end': 270.452, 'text': "We're going to talk about the different types of endpoints that we can create.", 'start': 267.25, 'duration': 3.202}, {'end': 278.318, 'text': 'Now, what about this REST thing here? Well, that stands for, I think, Representational State Transfer.', 'start': 271.133, 'duration': 7.185}, {'end': 285.506, 'text': 'I had to look that up a little bit ago because I was like, what was it? Anyways, this is the means of communication.', 'start': 278.438, 'duration': 7.068}, {'end': 290.168, 'text': 'So, you know I can talk to you in English, but how am I talking to you??', 'start': 285.926, 'duration': 4.242}, {'end': 291.649, 'text': 'Am I talking to you over the phone??', 'start': 290.188, 'duration': 1.461}, {'end': 292.87, 'text': 'Am I texting you??', 'start': 291.989, 'duration': 0.881}, {'end': 295.031, 'text': 'Am I talking to you face to face??', 'start': 293.39, 'duration': 1.641}], 'summary': 'Discussion on creating different types of endpoints and understanding rest as a means of communication.', 'duration': 27.781, 'max_score': 267.25, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo267250.jpg'}], 'start': 0.089, 'title': 'Rest api basics', 'summary': 'Covers rest api basics, including how to consume and build an api in python, with a free reference pdf available. it emphasizes the importance of understanding rest api concepts and its relevance in software development. additionally, it explains the concept of apis, including their purpose, common usage, and the role of json and rest in facilitating communication between software applications.', 'chapters': [{'end': 39.321, 'start': 0.089, 'title': 'Rest api crash course', 'summary': 'Covers the basics of rest apis, including how to consume an api and build one in python, with a free reference pdf available. it emphasizes the importance of understanding rest api concepts and its relevance in software development.', 'duration': 39.232, 'highlights': ['The chapter covers the basics of REST APIs, including how to consume an API and build one in Python.', 'A free reference PDF is available for further study and understanding of REST APIs.', 'The importance of understanding REST API concepts and its relevance in software development is emphasized.']}, {'end': 316.55, 'start': 39.321, 'title': 'Understanding apis and rest', 'summary': 'Explains the concept of apis, including their purpose, common usage, and the role of json and rest in facilitating communication between software applications.', 'duration': 277.229, 'highlights': ['API stands for application programming interface, a means for different software applications to communicate with each other, overcoming language barriers and facilitating requests and responses.', 'JSON, or JavaScript Object Notation, is the standard language for APIs, providing a simple way to describe information using key-value pairs, and is supported in various programming languages.', 'REST, Representational State Transfer, describes the means of communication over the internet, allowing requests for data in JSON format, similar to requesting a website for HTML.']}], 'duration': 316.461, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo89.jpg', 'highlights': ['The chapter covers the basics of REST APIs, including how to consume and build one in Python.', 'A free reference PDF is available for further study and understanding of REST APIs.', 'The importance of understanding REST API concepts and its relevance in software development is emphasized.', 'API stands for application programming interface, a means for different software applications to communicate with each other, overcoming language barriers and facilitating requests and responses.', 'JSON, or JavaScript Object Notation, is the standard language for APIs, providing a simple way to describe information using key-value pairs, and is supported in various programming languages.', 'REST, Representational State Transfer, describes the means of communication over the internet, allowing requests for data in JSON format, similar to requesting a website for HTML.']}, {'end': 900.207, 'segs': [{'end': 388.926, 'src': 'embed', 'start': 316.69, 'weight': 3, 'content': [{'end': 320.553, 'text': "So to make this a little bit more concrete, let's go over an example of an app I'm working on.", 'start': 316.69, 'duration': 3.863}, {'end': 323.735, 'text': 'So I have some software written in Python.', 'start': 320.733, 'duration': 3.002}, {'end': 327.578, 'text': 'And this is the server software.', 'start': 325.536, 'duration': 2.042}, {'end': 330.42, 'text': 'You may also hear it as the backend software.', 'start': 327.618, 'duration': 2.802}, {'end': 335.859, 'text': "And this is the software that's going to communicate with a database.", 'start': 332.33, 'duration': 3.529}, {'end': 338.706, 'text': "That's where all of our information and data is going to be stored.", 'start': 336.019, 'duration': 2.687}, {'end': 341.152, 'text': 'So this talks to the database.', 'start': 339.207, 'duration': 1.945}, {'end': 350.234, 'text': "Now we want other pieces of software to be able to communicate to this backend software, but we don't just want them to be able to access anything.", 'start': 342.267, 'duration': 7.967}, {'end': 353.117, 'text': "We don't want to give direct access to this database.", 'start': 350.514, 'duration': 2.603}, {'end': 357.12, 'text': 'So instead we expose different API endpoints.', 'start': 353.337, 'duration': 3.783}, {'end': 368.23, 'text': "So an example of an API endpoint would be forward slash And this, I haven't described what the actual app is for, but forward slash drinks.", 'start': 357.701, 'duration': 10.529}, {'end': 375.356, 'text': 'Now the actual app is to get a list of drinks and be able to rate these you know, like zero to 10,', 'start': 368.67, 'duration': 6.686}, {'end': 377.778, 'text': 'or to put them in different categories of how good they are.', 'start': 375.356, 'duration': 2.422}, {'end': 381.281, 'text': 'And then you can basically keep track of all your favorite drinks.', 'start': 378.398, 'duration': 2.883}, {'end': 384.263, 'text': "It's a little silly, but I thought it'd be a fun project.", 'start': 381.681, 'duration': 2.582}, {'end': 387.645, 'text': 'And basically, I like to drink.', 'start': 384.803, 'duration': 2.842}, {'end': 388.926, 'text': "I don't like to drink.", 'start': 388.045, 'duration': 0.881}], 'summary': 'A python server software communicates with a database, exposing api endpoints for an app to list and rate drinks.', 'duration': 72.236, 'max_score': 316.69, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo316690.jpg'}, {'end': 439.599, 'src': 'embed', 'start': 412.302, 'weight': 7, 'content': [{'end': 418.513, 'text': "So in this situation, we are getting data and that's one of the different methods of APIs.", 'start': 412.302, 'duration': 6.211}, {'end': 420.497, 'text': "We're going to talk about API methods here in a minute.", 'start': 418.574, 'duration': 1.923}, {'end': 428.244, 'text': "But what this means is my software that I built over here And in this situation, let's just say this is JavaScript.", 'start': 420.938, 'duration': 7.306}, {'end': 439.599, 'text': 'I can get all of the drinks or a specific drink from my backend software just by making a request to this web address.', 'start': 429.285, 'duration': 10.314}], 'summary': 'Discussing different api methods for retrieving data from backend software.', 'duration': 27.297, 'max_score': 412.302, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo412302.jpg'}, {'end': 580.336, 'src': 'embed', 'start': 556.809, 'weight': 6, 'content': [{'end': 565.412, 'text': 'The most biggest, importantest reason of not going from the client application directly to the database is security,', 'start': 556.809, 'duration': 8.603}, {'end': 568.733, 'text': 'specifically if you are using JavaScript.', 'start': 565.412, 'duration': 3.321}, {'end': 573.654, 'text': "Now, oftentimes the client is going to be JavaScript because that's used for web pages.", 'start': 569.213, 'duration': 4.441}, {'end': 577.875, 'text': 'However, you could also make a console application or a mobile application.', 'start': 573.974, 'duration': 3.901}, {'end': 580.336, 'text': "So it's not always going to be JavaScript.", 'start': 578.296, 'duration': 2.04}], 'summary': 'Avoid direct client-to-database access for security, especially with javascript.', 'duration': 23.527, 'max_score': 556.809, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo556809.jpg'}, {'end': 667.948, 'src': 'embed', 'start': 645.379, 'weight': 0, 'content': [{'end': 655.128, 'text': 'So what happens now is both of these front-end applications are sharing the same backend, which means these are always going to have the same data.', 'start': 645.379, 'duration': 9.749}, {'end': 656.83, 'text': "They're going to be synchronized.", 'start': 655.388, 'duration': 1.442}, {'end': 663.925, 'text': 'So that is how, when you have applications on your phone, you can go in there and change data,', 'start': 658.001, 'duration': 5.924}, {'end': 667.948, 'text': 'and then you can go log in on your computer and all of that stuff still exists.', 'start': 663.925, 'duration': 4.023}], 'summary': 'Front-end applications share the same backend, ensuring synchronized data across devices.', 'duration': 22.569, 'max_score': 645.379, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo645379.jpg'}, {'end': 722.693, 'src': 'embed', 'start': 692.444, 'weight': 1, 'content': [{'end': 697.348, 'text': "But ultimately, we're hiding the back end of this application and separating those.", 'start': 692.444, 'duration': 4.904}, {'end': 700.81, 'text': 'Which brings up the next good point, which is modularity.', 'start': 697.808, 'duration': 3.002}, {'end': 708.495, 'text': "Because the front end and the back end are separated and we're just defining this consistent way to communicate.", 'start': 701.21, 'duration': 7.285}, {'end': 712.338, 'text': 'we can actually swap different things out and not necessarily break.', 'start': 708.495, 'duration': 3.843}, {'end': 716.321, 'text': 'I say necessarily because, you know, in practice, it could be difficult.', 'start': 712.678, 'duration': 3.643}, {'end': 722.693, 'text': 'But in theory, you should be able to swap out different things without breaking other pieces of the application.', 'start': 716.661, 'duration': 6.032}], 'summary': 'Separating the front end and back end allows for modular communication and potential swapping without breaking.', 'duration': 30.249, 'max_score': 692.444, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo692444.jpg'}, {'end': 812.585, 'src': 'embed', 'start': 784.467, 'weight': 2, 'content': [{'end': 789.329, 'text': 'have to be built by you or the front end development team for your company.', 'start': 784.467, 'duration': 4.862}, {'end': 796.011, 'text': 'You can actually expose certain endpoints, such as this one right here, and you could make this public.', 'start': 789.829, 'duration': 6.182}, {'end': 803.383, 'text': "So if you make certain endpoints public, you don't have to worry about authentication or authorization.", 'start': 797.321, 'duration': 6.062}, {'end': 812.585, 'text': 'And in that situation, anybody could go ahead and create some new app, new and improved, to consume your API.', 'start': 803.803, 'duration': 8.782}], 'summary': 'Endpoints can be made public, allowing anyone to create apps to consume the api.', 'duration': 28.118, 'max_score': 784.467, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo784467.jpg'}, {'end': 906.732, 'src': 'embed', 'start': 880.61, 'weight': 8, 'content': [{'end': 887.576, 'text': 'So the authorization aspect of this is like a whole nother beast, but a common thing you often see is OAuth2.', 'start': 880.61, 'duration': 6.966}, {'end': 890.339, 'text': "That is an authentication technique that's fairly common.", 'start': 887.857, 'duration': 2.482}, {'end': 897.645, 'text': 'So if you want to look into how to protect your API and make you basically have to log in, you can look into OAuth.', 'start': 890.459, 'duration': 7.186}, {'end': 900.207, 'text': "That's O-A-U-T-H.", 'start': 898.005, 'duration': 2.202}, {'end': 906.732, 'text': 'Now I want to take a moment to talk about the different methods of requesting data from the server.', 'start': 901.649, 'duration': 5.083}], 'summary': 'Oauth2 is a common authentication technique for protecting apis and ensuring login.', 'duration': 26.122, 'max_score': 880.61, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo880610.jpg'}], 'start': 316.69, 'title': 'Backend versatility benefits', 'summary': 'Discusses the benefits of using a shared backend for front-end applications, including synchronization, modularity, and interoperability, facilitating automation and third-party app development.', 'chapters': [{'end': 368.23, 'start': 316.69, 'title': 'Api endpoint security for python backend', 'summary': "Discusses securing an api endpoint for a python backend, which communicates with a database and exposes different api endpoints to prevent direct access, exemplified by the 'drinks' endpoint.", 'duration': 51.54, 'highlights': ['The backend software in Python communicates with a database where all information is stored.', "Different API endpoints are exposed to allow communication with the backend software without direct access to the database, for example, the 'drinks' endpoint."]}, {'end': 626.535, 'start': 368.67, 'title': 'Developing a drink ranking website', 'summary': 'Discusses the development of a website for ranking drinks, including the ability to rate drinks, retrieve specific drinks via an api, and the importance of separating client applications and the database for security reasons.', 'duration': 257.865, 'highlights': ["The website's purpose is to list drinks and allow users to rate them on a scale of zero to 10 or categorize them, providing a convenient way to keep track of favorite drinks.", 'The API allows for retrieving all drinks or a specific drink by passing an ID, which returns JSON data about the requested drink.', 'Separating client applications and the database is crucial for security, especially when using JavaScript, to prevent exposing sensitive information to users and potential security breaches.']}, {'end': 900.207, 'start': 626.875, 'title': 'Benefits of backend versatility', 'summary': 'Explains the benefits of using a shared backend for front-end applications, including synchronization, modularity, and interoperability, enabling easy adaptation to different technologies and the creation of public apis, facilitating automation and third-party app development.', 'duration': 273.332, 'highlights': ['Shared backend ensures data synchronization between front-end applications, enabling consistent data across different platforms.', 'Separation of front-end and back-end allows for modularity and the ability to swap out different technologies without breaking the application.', 'Ability to expose certain endpoints as public APIs enables third-party app development and automation, such as cryptocurrency trading bots.', 'Public APIs, like the one mentioned, can be accessed for various purposes, including creating new apps and automating different processes.', 'The use of authentication techniques like OAuth2 helps ensure security and control over access to the API.']}], 'duration': 583.517, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo316690.jpg', 'highlights': ['Shared backend ensures data synchronization between front-end applications.', 'Separation of front-end and back-end allows for modularity and the ability to swap out different technologies without breaking the application.', 'Ability to expose certain endpoints as public APIs enables third-party app development and automation.', 'The backend software in Python communicates with a database where all information is stored.', 'Different API endpoints are exposed to allow communication with the backend software without direct access to the database.', "The website's purpose is to list drinks and allow users to rate them on a scale of zero to 10 or categorize them.", 'Separating client applications and the database is crucial for security, especially when using JavaScript.', 'The API allows for retrieving all drinks or a specific drink by passing an ID, which returns JSON data about the requested drink.', 'The use of authentication techniques like OAuth2 helps ensure security and control over access to the API.']}, {'end': 1226.921, 'segs': [{'end': 929.191, 'src': 'embed', 'start': 901.649, 'weight': 1, 'content': [{'end': 906.732, 'text': 'Now I want to take a moment to talk about the different methods of requesting data from the server.', 'start': 901.649, 'duration': 5.083}, {'end': 909.454, 'text': "So we've talked about get, and this one's pretty simple.", 'start': 906.732, 'duration': 2.722}, {'end': 917.22, 'text': "It's what's used to retrieve data from the server, And these are often written in all uppercase letters.", 'start': 909.514, 'duration': 7.706}, {'end': 929.191, 'text': "So you're just like screaming give me this information, alright, so get is used to retrieve data, and I could just say get data, but fancy here.", 'start': 917.22, 'duration': 11.971}], 'summary': 'The get method retrieves data from the server using all uppercase letters.', 'duration': 27.542, 'max_score': 901.649, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo901649.jpg'}, {'end': 1021.206, 'src': 'embed', 'start': 971.886, 'weight': 0, 'content': [{'end': 975.108, 'text': 'Post should be used to write new data.', 'start': 971.886, 'duration': 3.222}, {'end': 977.208, 'text': 'Put should be used to write.', 'start': 975.388, 'duration': 1.82}, {'end': 980.77, 'text': "But in this situation, we're going to update data.", 'start': 978.209, 'duration': 2.561}, {'end': 988.73, 'text': 'So now I wanna show you how these things correlate to the most popular things you have to do with the database, which is CRUD.', 'start': 982.267, 'duration': 6.463}, {'end': 999.975, 'text': 'So the different things you need to do, we need to be able to create data, post, read data, get, update data, put, and delete data, delete.', 'start': 989.57, 'duration': 10.405}, {'end': 1005.957, 'text': "Now, why exactly is there confusion between post and put? That's what I wanna talk about now.", 'start': 1000.615, 'duration': 5.342}, {'end': 1009.059, 'text': "Well, first let's talk about how post and put are generally used.", 'start': 1006.178, 'duration': 2.881}, {'end': 1011.5, 'text': 'Post is used to add a resource.', 'start': 1009.659, 'duration': 1.841}, {'end': 1014.602, 'text': 'Put is used to replace a resource.', 'start': 1011.94, 'duration': 2.662}, {'end': 1021.206, 'text': "And that's why it's natural in my mind to say you can use put to update data and post to add new data.", 'start': 1014.922, 'duration': 6.284}], 'summary': 'Using post for new data, put for writing, and put to update data in crud operations.', 'duration': 49.32, 'max_score': 971.886, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo971886.jpg'}, {'end': 1092.611, 'src': 'embed', 'start': 1068.944, 'weight': 3, 'content': [{'end': 1076.806, 'text': "but there's another difference, and this is more defined in the spec of how an api is supposed to work and less about pure functionality,", 'start': 1068.944, 'duration': 7.862}, {'end': 1079.247, 'text': "because you're the one who defines the functionality.", 'start': 1076.806, 'duration': 2.441}, {'end': 1087.409, 'text': 'so if you want your api to work correctly, then you need to make sure you implement it in this way and that, is put,', 'start': 1079.247, 'duration': 8.162}, {'end': 1092.611, 'text': 'is designed to give the same result every time if you make the same request.', 'start': 1087.409, 'duration': 5.202}], 'summary': 'Api design must ensure consistent results for each request.', 'duration': 23.667, 'max_score': 1068.944, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1068944.jpg'}, {'end': 1191.2, 'src': 'embed', 'start': 1164.406, 'weight': 4, 'content': [{'end': 1168.468, 'text': "Now I'm probably gonna mess this word up, but there's a word to describe this, idempotent.", 'start': 1164.406, 'duration': 4.062}, {'end': 1172.73, 'text': "Yeah, idempotent, I don't know.", 'start': 1170.309, 'duration': 2.421}, {'end': 1174.751, 'text': 'So put is said to be this.', 'start': 1172.75, 'duration': 2.001}, {'end': 1179.033, 'text': "I'm not even gonna try anymore, just whatever that's called.", 'start': 1176.532, 'duration': 2.501}, {'end': 1187.158, 'text': "Now in general, I think there's a lot of confusion between post and put, and you can pretty much do the same behaviors with either one.", 'start': 1179.794, 'duration': 7.364}, {'end': 1191.2, 'text': 'So I tend to just try to stick with post most of the time.', 'start': 1187.218, 'duration': 3.982}], 'summary': 'Confusion between post and put, can do same behaviors, stick with post most of the time.', 'duration': 26.794, 'max_score': 1164.406, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1164406.jpg'}], 'start': 901.649, 'title': 'Server data request methods and api idempotency', 'summary': "Covers different server data request methods including get, post, and delete, and explains the confusion between post and put. it also discusses the idempotency differences between put and post methods, emphasizing put's guarantee of the same result every time.", 'chapters': [{'end': 1068.944, 'start': 901.649, 'title': 'Server data request methods', 'summary': 'Discusses different methods of requesting data from the server, such as get for retrieving data, post for writing data, delete for deleting, and the confusion between post and put, which are commonly used for creating and updating resources.', 'duration': 167.295, 'highlights': ['POST is used to write data. POST method is used to write new data to the server, such as adding a new resource to the database.', 'GET is used to retrieve data from the server. GET method is used to retrieve existing data from the server.', 'The confusion between POST and PUT in updating data. There is a gray area in using POST and PUT for updating data, with the distinction that POST is for adding new data and PUT is for updating existing data.', 'The purpose of using PUT to replace a resource. PUT is used to replace an existing resource, often identified by an ID, and is suitable for updating data by specifying the resource to be replaced.', 'The use of ID in PUT requests for updating data. When using PUT to update data, an ID is often required to identify the resource that needs to be replaced, which may already exist after a POST request.']}, {'end': 1226.921, 'start': 1068.944, 'title': 'Api functionality and idempotency', 'summary': 'Discusses the differences between the put and post methods in an api, where put is guaranteed to give the same result every time, while post can lead to duplicate records or errors due to its lack of idempotency.', 'duration': 157.977, 'highlights': ['The PUT method in an API is designed to give the same result every time if the same request is made, allowing for multiple executions without side effects.', 'The POST method, unlike PUT, is not guaranteed to be executed multiple times without side effects, potentially leading to duplicate records in the database or errors if the resource is defined to be unique.', "The term 'idempotent' is used to describe the guaranteed behavior of the PUT method, ensuring consistent results with repeated executions.", 'The chapter also briefly mentions the PATCH method, which is used to update specific fields of a resource.']}], 'duration': 325.272, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo901649.jpg', 'highlights': ['POST is used to write new data to the server, such as adding a new resource to the database.', 'GET method is used to retrieve existing data from the server.', 'The confusion between POST and PUT in updating data, with the distinction that POST is for adding new data and PUT is for updating existing data.', 'The PUT method in an API is designed to give the same result every time if the same request is made, allowing for multiple executions without side effects.', "The term 'idempotent' is used to describe the guaranteed behavior of the PUT method, ensuring consistent results with repeated executions."]}, {'end': 1651.843, 'segs': [{'end': 1279.067, 'src': 'heatmap', 'start': 1243.729, 'weight': 0.874, 'content': [{'end': 1249.631, 'text': 'So my theory is you basically keep the state of an object in the client side application.', 'start': 1243.729, 'duration': 5.902}, {'end': 1255.634, 'text': 'And then once you save, you just send that new state and replace the old state in the database.', 'start': 1250.191, 'duration': 5.443}, {'end': 1257.254, 'text': 'Hopefully that makes sense.', 'start': 1256.394, 'duration': 0.86}, {'end': 1261.596, 'text': "All right, so let's get some practice with APIs by consuming an existing API.", 'start': 1257.574, 'duration': 4.022}, {'end': 1264.357, 'text': "We're going to take a look at Stack Overflow.", 'start': 1261.996, 'duration': 2.361}, {'end': 1270.161, 'text': 'So all of the questions on here, you can get access to this information through an API.', 'start': 1265.057, 'duration': 5.104}, {'end': 1273.964, 'text': 'So we can build an application to work with Stack Overflow.', 'start': 1270.581, 'duration': 3.383}, {'end': 1279.067, 'text': 'So to do this, you actually go to api.stackexchange.com.', 'start': 1274.684, 'duration': 4.383}], 'summary': 'Client-side object state is saved and sent to replace old state in the database. practice consuming stack overflow api for building applications.', 'duration': 35.338, 'max_score': 1243.729, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1243729.jpg'}, {'end': 1279.067, 'src': 'embed', 'start': 1250.191, 'weight': 4, 'content': [{'end': 1255.634, 'text': 'And then once you save, you just send that new state and replace the old state in the database.', 'start': 1250.191, 'duration': 5.443}, {'end': 1257.254, 'text': 'Hopefully that makes sense.', 'start': 1256.394, 'duration': 0.86}, {'end': 1261.596, 'text': "All right, so let's get some practice with APIs by consuming an existing API.", 'start': 1257.574, 'duration': 4.022}, {'end': 1264.357, 'text': "We're going to take a look at Stack Overflow.", 'start': 1261.996, 'duration': 2.361}, {'end': 1270.161, 'text': 'So all of the questions on here, you can get access to this information through an API.', 'start': 1265.057, 'duration': 5.104}, {'end': 1273.964, 'text': 'So we can build an application to work with Stack Overflow.', 'start': 1270.581, 'duration': 3.383}, {'end': 1279.067, 'text': 'So to do this, you actually go to api.stackexchange.com.', 'start': 1274.684, 'duration': 4.383}], 'summary': 'Learning to consume stack overflow api at api.stackexchange.com', 'duration': 28.876, 'max_score': 1250.191, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1250191.jpg'}, {'end': 1393.57, 'src': 'embed', 'start': 1364.16, 'weight': 3, 'content': [{'end': 1367.722, 'text': 'And then we have another question, which has tags, owner, a bunch of other stuff.', 'start': 1364.16, 'duration': 3.562}, {'end': 1369.643, 'text': 'And it just repeats in a list.', 'start': 1367.982, 'duration': 1.661}, {'end': 1373.406, 'text': "So what we're going to do is we're going to work with this API.", 'start': 1370.404, 'duration': 3.002}, {'end': 1376.568, 'text': 'So a tool I would recommend you get is called Postman.', 'start': 1373.646, 'duration': 2.922}, {'end': 1379.951, 'text': 'And in here, you can work with your APIs.', 'start': 1377.469, 'duration': 2.482}, {'end': 1386.035, 'text': "And it's just a little bit easier because you can customize the body and the different headers of your requests.", 'start': 1380.131, 'duration': 5.904}, {'end': 1390.138, 'text': "And what we're going to do is we're just going to take this web address here.", 'start': 1386.815, 'duration': 3.323}, {'end': 1393.57, 'text': 'and paste it on here.', 'start': 1392.387, 'duration': 1.183}], 'summary': 'Using postman to work with apis for easier customization and request management.', 'duration': 29.41, 'max_score': 1364.16, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1364160.jpg'}, {'end': 1466.24, 'src': 'embed', 'start': 1435.952, 'weight': 1, 'content': [{'end': 1438.255, 'text': "What we're going to do is we're going to need a few tools.", 'start': 1435.952, 'duration': 2.303}, {'end': 1442.98, 'text': "So we're going to say import requests and import JSON.", 'start': 1438.275, 'duration': 4.705}, {'end': 1447.263, 'text': 'if this is your first time working with requests, you might need to install it.', 'start': 1443.499, 'duration': 3.764}, {'end': 1454.149, 'text': 'so what we can do is we can open a terminal and say pip3 install requests, all right.', 'start': 1447.263, 'duration': 6.886}, {'end': 1462.616, 'text': 'so now we have requests installed and we should be able to make a request to a web page by saying request dot,', 'start': 1454.149, 'duration': 8.467}, {'end': 1466.24, 'text': 'get and pasting in a web address inside of a string here.', 'start': 1462.616, 'duration': 3.624}], 'summary': 'Using requests and json to make web requests, install with pip3.', 'duration': 30.288, 'max_score': 1435.952, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1435952.jpg'}, {'end': 1512.307, 'src': 'embed', 'start': 1484.466, 'weight': 2, 'content': [{'end': 1493.032, 'text': "now we can actually see the data that's returned by running dot json as a method here, and that's going to give us all of the data,", 'start': 1484.466, 'duration': 8.566}, {'end': 1498.095, 'text': 'exactly as we would if we requested it in the web browser or with postman.', 'start': 1493.032, 'duration': 5.063}, {'end': 1502.578, 'text': 'so we got the items and then a list of all of the different questions.', 'start': 1498.095, 'duration': 4.483}, {'end': 1512.307, 'text': 'So we can basically zoom in on this and instead of just having one key value pair where we have items and then a giant list,', 'start': 1503.398, 'duration': 8.909}], 'summary': 'Using dot json method to retrieve all data items and questions.', 'duration': 27.841, 'max_score': 1484.466, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1484466.jpg'}, {'end': 1627.193, 'src': 'embed', 'start': 1602.554, 'weight': 0, 'content': [{'end': 1610.801, 'text': 'so maybe you could build some kind of application to help you find good stack overflow questions to try to answer before anyone else does.', 'start': 1602.554, 'duration': 8.247}, {'end': 1613.423, 'text': 'so you can be a little bit more specific.', 'start': 1610.801, 'duration': 2.622}, {'end': 1618.226, 'text': 'you know, you could go in here and you could check to see the answer count.', 'start': 1613.423, 'duration': 4.803}, {'end': 1621.109, 'text': 'answer count is like two for this one.', 'start': 1618.226, 'duration': 2.883}, {'end': 1627.193, 'text': 'so maybe maybe you only want to print the ones where the answer count is zero.', 'start': 1621.109, 'duration': 6.084}], 'summary': 'Develop an application to find unanswered stack overflow questions, considering answer count and print specific questions.', 'duration': 24.639, 'max_score': 1602.554, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1602554.jpg'}], 'start': 1227.281, 'title': 'Working with apis and data management in python', 'summary': "Covers consuming an api from stack overflow, using query parameters, working with api in python using postman and 'requests' library, and retrieving and filtering data from a json response, emphasizing the possibility of building an application to identify unanswered stack overflow questions.", 'chapters': [{'end': 1344.68, 'start': 1227.281, 'title': 'Api usage and data management', 'summary': 'Explains the process of consuming an existing api from stack overflow and emphasizes the benefits of replacing small data with a new version for ease of management. it also introduces the concept of using query parameters to modify api results.', 'duration': 117.399, 'highlights': ['The benefits of replacing small data with a new version for ease of management Replacing small data with a new version is highlighted as a more convenient approach for data management.', 'Introduction to consuming an existing API from Stack Overflow The transcript introduces the process of consuming an existing API from Stack Overflow and the potential application development using its data.', 'Explanation of using query parameters to modify API results The concept of using query parameters to modify API results is explained as a way to customize the data retrieved from the API.']}, {'end': 1482.623, 'start': 1344.68, 'title': 'Working with api in python', 'summary': "Covers working with api in python using postman to send requests and manipulate json data, and installing and using the 'requests' library to make web requests, as well as parsing the json response.", 'duration': 137.943, 'highlights': ["The chapter covers working with API in Python using Postman to send requests and manipulate JSON data, and installing and using the 'requests' library to make web requests, as well as parsing the JSON response.", 'Postman is recommended as a tool for working with APIs, providing the ability to customize request bodies and headers for easier API interaction.', "The transcript discusses the process of making a request to a web page in Python using the 'requests' library, including installation steps using 'pip3' and parsing the JSON response.", 'The chapter explains the structure of JSON data, highlighting key value pairs and lists (arrays) within the data, providing a clear understanding of the data format for manipulation in Python.']}, {'end': 1651.843, 'start': 1484.466, 'title': 'Data retrieval and filtering in python', 'summary': 'Demonstrates retrieving and filtering data from a json response in python, iterating through the items to extract the titles and links of questions, and suggests the possibility of building an application to identify unanswered stack overflow questions.', 'duration': 167.377, 'highlights': ['The chapter demonstrates how to retrieve and filter data from a JSON response in Python, showing the process of accessing all the data, zooming in on specific items, and iterating through a list of questions.', 'It provides a practical example of iterating through the items in the JSON response to extract titles and links of the questions, showcasing the process of printing out each question and its corresponding link.', 'The tutorial suggests the potential of building an application to identify unanswered Stack Overflow questions, with the option to filter questions based on criteria such as the answer count.']}], 'duration': 424.562, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1227281.jpg', 'highlights': ['The tutorial suggests the potential of building an application to identify unanswered Stack Overflow questions, with the option to filter questions based on criteria such as the answer count.', "The chapter covers working with API in Python using Postman to send requests and manipulate JSON data, and installing and using the 'requests' library to make web requests, as well as parsing the JSON response.", 'The chapter demonstrates how to retrieve and filter data from a JSON response in Python, showing the process of accessing all the data, zooming in on specific items, and iterating through a list of questions.', 'Postman is recommended as a tool for working with APIs, providing the ability to customize request bodies and headers for easier API interaction.', 'Introduction to consuming an existing API from Stack Overflow The transcript introduces the process of consuming an existing API from Stack Overflow and the potential application development using its data.']}, {'end': 2568.919, 'segs': [{'end': 1772.809, 'src': 'heatmap', 'start': 1681.243, 'weight': 4, 'content': [{'end': 1685.887, 'text': "And we're going to execute a sequence of commands in the terminal here.", 'start': 1681.243, 'duration': 4.644}, {'end': 1690.09, 'text': "So the very first thing is we're going to create a virtual environment.", 'start': 1685.967, 'duration': 4.123}, {'end': 1698.976, 'text': 'So to do that, you say python3-m virtual environment venv, and then give it a name such as .venv.', 'start': 1690.67, 'duration': 8.306}, {'end': 1701.038, 'text': "And that's going to create..", 'start': 1699.536, 'duration': 1.502}, {'end': 1710.767, 'text': 'a new folder in here for your virtual directory, which i talked about this in my previous video, where we deployed a python web app,', 'start': 1701.858, 'duration': 8.909}, {'end': 1715.571, 'text': 'but this is basically to isolate the dependencies for this specific application.', 'start': 1710.767, 'duration': 4.804}, {'end': 1721.737, 'text': 'now what we can do is we can activate that by saying source and then traveling to it.', 'start': 1715.571, 'duration': 6.166}, {'end': 1725.861, 'text': "so it's in the dot venv folder bin.", 'start': 1721.737, 'duration': 4.124}, {'end': 1730.075, 'text': 'So that is how you activate a virtual environment.', 'start': 1727.992, 'duration': 2.083}, {'end': 1734.643, 'text': 'Then we can install our dependencies, pip3 install flask.', 'start': 1730.716, 'duration': 3.927}, {'end': 1743.051, 'text': "And we're also going to install pip3 install flask sql alchemy.", 'start': 1735.768, 'duration': 7.283}, {'end': 1746.752, 'text': "And that's going to be used to work with the database.", 'start': 1743.511, 'duration': 3.241}, {'end': 1751.634, 'text': 'So this is an example of an ORM, which I think is an object relational mapper.', 'start': 1747.133, 'duration': 4.501}, {'end': 1755.856, 'text': 'And we can output all of our dependencies in a file if we want.', 'start': 1751.734, 'duration': 4.122}, {'end': 1756.956, 'text': 'So we can say pip3 freeze.', 'start': 1755.936, 'duration': 1.02}, {'end': 1761.64, 'text': 'and put this in requirements.txt.', 'start': 1758.517, 'duration': 3.123}, {'end': 1765.183, 'text': "so anytime you add a new dependency, you'll want to do that.", 'start': 1761.64, 'duration': 3.543}, {'end': 1765.563, 'text': 'just so.', 'start': 1765.183, 'duration': 0.38}, {'end': 1772.809, 'text': 'all of our requirements are in this text file, so whoever uses this project in the future can get the dependencies.', 'start': 1765.563, 'duration': 7.246}], 'summary': 'Creating a virtual environment, activating it, and installing dependencies for a python application using pip3.', 'duration': 82.139, 'max_score': 1681.243, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1681243.jpg'}, {'end': 1846.318, 'src': 'heatmap', 'start': 1808.393, 'weight': 1, 'content': [{'end': 1811.415, 'text': 'by saying app.route and giving it a path.', 'start': 1808.393, 'duration': 3.022}, {'end': 1816.098, 'text': 'And then we can define a method that we want hit when someone visits this route.', 'start': 1811.715, 'duration': 4.383}, {'end': 1820.621, 'text': "So all we're going to do for right now is just return a string hello.", 'start': 1816.779, 'duration': 3.842}, {'end': 1823.283, 'text': "All right, so let's just make sure this is working.", 'start': 1820.641, 'duration': 2.642}, {'end': 1825.765, 'text': 'So what we can do is run our application.', 'start': 1823.323, 'duration': 2.442}, {'end': 1830.167, 'text': "To do this, we're going to create a few environment variables real quick.", 'start': 1826.205, 'duration': 3.962}, {'end': 1846.318, 'text': "So flask app is application.py and the flask environment is development and you're going to need to do that anytime.", 'start': 1830.668, 'duration': 15.65}], 'summary': "Using app.route to define a route and method, returns 'hello', setting up flask app environment.", 'duration': 37.925, 'max_score': 1808.393, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1808393.jpg'}, {'end': 1949.68, 'src': 'embed', 'start': 1922.13, 'weight': 0, 'content': [{'end': 1925.313, 'text': 'Now we just got to worry about connecting to a database.', 'start': 1922.13, 'duration': 3.183}, {'end': 1933.792, 'text': 'So to do this with the object relational mapper, we basically define all of the things we want to store in our database as models.', 'start': 1926.348, 'duration': 7.444}, {'end': 1938.154, 'text': "So we're going to create a class so we can do that up here.", 'start': 1934.172, 'duration': 3.982}, {'end': 1943.937, 'text': "And all we're going to do is we're going to say class drink.", 'start': 1939.054, 'duration': 4.883}, {'end': 1948.159, 'text': 'And for SQL alchemy, we just say db.model.', 'start': 1944.577, 'duration': 3.582}, {'end': 1949.68, 'text': "So it's going to inherit from this.", 'start': 1948.199, 'duration': 1.481}], 'summary': "Using object relational mapper to define database models, like the 'drink' class inheriting from db.model.", 'duration': 27.55, 'max_score': 1922.13, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1922130.jpg'}, {'end': 2150.702, 'src': 'embed', 'start': 2115.93, 'weight': 1, 'content': [{'end': 2117.791, 'text': "so that's the setup for sql alchemy.", 'start': 2115.93, 'duration': 1.861}, {'end': 2123.414, 'text': 'the last thing we have to do is we need to configure our database so we can connect to it.', 'start': 2117.791, 'duration': 5.623}, {'end': 2136.071, 'text': "so we say app.config and We're going to pass in a string here SQLAlchemyDatabase.URI.", 'start': 2123.414, 'duration': 12.657}, {'end': 2138.873, 'text': "And you don't have to have all of this stuff memorized.", 'start': 2136.451, 'duration': 2.422}, {'end': 2143.537, 'text': 'You can find this in the documentation for Flask fairly simply.', 'start': 2139.493, 'duration': 4.044}, {'end': 2150.702, 'text': "And then we're going to say SQLite and then three forward slashes data.db.", 'start': 2144.137, 'duration': 6.565}], 'summary': 'Configuring database for sql alchemy with sqlite uri', 'duration': 34.772, 'max_score': 2115.93, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2115930.jpg'}, {'end': 2302.968, 'src': 'embed', 'start': 2272.153, 'weight': 2, 'content': [{'end': 2281.676, 'text': 'Now to add it to our table, we say db.session.addDrink, and then db.session.commit.', 'start': 2272.153, 'duration': 9.523}, {'end': 2283.137, 'text': "And that's an important step.", 'start': 2281.996, 'duration': 1.141}, {'end': 2287.198, 'text': 'Yeah, we want db.session.commit, not doctor.', 'start': 2283.397, 'duration': 3.801}, {'end': 2290.519, 'text': 'So db.session.commit.', 'start': 2288.618, 'duration': 1.901}, {'end': 2297.426, 'text': 'Now we should be able to get all of our drinks by saying drink.query.all.', 'start': 2292.065, 'duration': 5.361}, {'end': 2298.647, 'text': 'Hit enter.', 'start': 2298.187, 'duration': 0.46}, {'end': 2302.968, 'text': "And you can see it's a list now with just one element, grape soda.", 'start': 2299.127, 'duration': 3.841}], 'summary': 'Using db.session to add and retrieve drinks. one element, grape soda.', 'duration': 30.815, 'max_score': 2272.153, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2272153.jpg'}, {'end': 2448.347, 'src': 'embed', 'start': 2411.549, 'weight': 3, 'content': [{'end': 2414.271, 'text': "So we're going to say output is just an empty list.", 'start': 2411.549, 'duration': 2.722}, {'end': 2417.834, 'text': "From here, what we're going to do is we're going to iterate through the drinks.", 'start': 2415.012, 'duration': 2.822}, {'end': 2423.798, 'text': "So we'll say for drink in drinks, and we're going to describe what it will look like inside of a dictionary.", 'start': 2417.914, 'duration': 5.884}, {'end': 2426.5, 'text': 'So the end goal is to have a list of dictionaries.', 'start': 2423.858, 'duration': 2.642}, {'end': 2433.945, 'text': "So we'll just say drink data is a dictionary where name comes from drink.name.", 'start': 2426.96, 'duration': 6.985}, {'end': 2448.347, 'text': 'and the description comes from drink dot description like so, and then, once we got that dictionary,', 'start': 2437.245, 'duration': 11.102}], 'summary': 'The goal is to iterate through drinks and create a list of dictionaries containing drink data.', 'duration': 36.798, 'max_score': 2411.549, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2411549.jpg'}], 'start': 1651.843, 'title': 'Creating python api and flask application with sqlalchemy', 'summary': 'Covers creating a python api with flask and sqlalchemy, including setting up environment, installing dependencies, creating routes, and defining models. it also explains creating a drink model, setting up a database using sqlite, configuring the database, and displaying drinks in json format.', 'chapters': [{'end': 1772.809, 'start': 1651.843, 'title': 'Creating a python api with flask and sqlalchemy', 'summary': 'Discusses the process of creating a python api using flask and sqlalchemy, including setting up the environment, activating a virtual environment, installing dependencies such as flask and sqlalchemy, and managing dependencies using a requirements.txt file.', 'duration': 120.966, 'highlights': ["Setting up a virtual environment and isolating dependencies for the specific application The process involves creating a virtual environment using the command 'python3 -m venv .venv' to isolate dependencies, ensuring the specific application's dependencies are isolated for future use.", "Activating the virtual environment and installing dependencies using pip3 After creating the virtual environment, it needs to be activated using the 'source' command and the dependencies such as Flask and SQLAlchemy are installed using 'pip3 install flask' and 'pip3 install flask sql alchemy'.", "Managing dependencies using a requirements.txt file The dependencies can be output to a file using 'pip3 freeze' and redirecting the output to a 'requirements.txt' file, ensuring that all project dependencies are documented for future use."]}, {'end': 2014.657, 'start': 1772.809, 'title': 'Creating a flask application with sql alchemy', 'summary': 'Explains the process of creating a flask application, creating routes, and defining models with sql alchemy for database connectivity.', 'duration': 241.848, 'highlights': ["We create a basic flask application and define a simple route to return a string 'hello'. Creation of a basic flask application, defining a simple route", 'Environment variables such as flask app and flask environment are set to run the application. Setting environment variables for running the application', "Definition of a class 'drink' as a model to store data in the database using SQL Alchemy. Defining a class 'drink' as a model, using SQL Alchemy for database connectivity"]}, {'end': 2568.919, 'start': 2014.857, 'title': 'Creating a drink model and setting up a database', 'summary': 'Covers creating a drink model and setting up a database using sqlite, including defining the repr method, setting up the sql alchemy, configuring the database, creating and adding drinks to the database, and building a route to display the drinks in a json format.', 'duration': 554.062, 'highlights': ['Creating a drink model and setting up a database using SQLite The chapter covers creating a drink model and setting up a database using SQLite, including defining the repr method, setting up the SQL Alchemy, configuring the database, creating and adding drinks to the database, and building a route to display the drinks in a JSON format.', "Defining the repr method to grab the object's attributes The repr method is used to grab the object's attributes by passing in self, allowing access to the object's attributes by saying self dot something, and then returning a string invoked whenever trying to print out the drink in the list.", 'Setting up SQL Alchemy and configuring the database Setting up SQL Alchemy by importing sql alchemy and creating an instance of sql alchemy to pass into the flask app, and configuring the database by providing the URI for an SQLite database called data.db in the same directory.', 'Creating and adding drinks to the database Creating a new drink object and assigning it to a variable called drink, passing in data to create a drink using named parameters, adding the drink to the database using db.session.addDrink, and committing the changes using db.session.commit.', 'Building a route to display the drinks in a JSON format Building a route to display the drinks in a JSON format by iterating through the drinks, creating a list of dictionaries containing the drink data, and displaying the output as a list of dictionaries, making it serializable and accessible in a JSON format.']}], 'duration': 917.076, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo1651843.jpg', 'highlights': ['Creating a drink model and setting up a database using SQLite, including defining the repr method, setting up the SQL Alchemy, configuring the database, creating and adding drinks to the database, and building a route to display the drinks in a JSON format.', 'Setting up SQL Alchemy and configuring the database by providing the URI for an SQLite database called data.db in the same directory.', 'Creating and adding drinks to the database by passing in data to create a drink using named parameters, adding the drink to the database using db.session.addDrink, and committing the changes using db.session.commit.', 'Building a route to display the drinks in a JSON format by iterating through the drinks, creating a list of dictionaries containing the drink data, and displaying the output as a list of dictionaries, making it serializable and accessible in a JSON format.', "Setting up a virtual environment and isolating dependencies for the specific application using the command 'python3 -m venv .venv' to isolate dependencies, ensuring the specific application's dependencies are isolated for future use.", 'Activating the virtual environment and installing dependencies using pip3 after creating the virtual environment, ensuring that all project dependencies are documented for future use.', "Managing dependencies using a requirements.txt file by outputting the dependencies to a file using 'pip3 freeze' and redirecting the output to a 'requirements.txt' file."]}, {'end': 3149.397, 'segs': [{'end': 2626.275, 'src': 'embed', 'start': 2598.505, 'weight': 2, 'content': [{'end': 2601.166, 'text': 'And from here, we can pass in the ID.', 'start': 2598.505, 'duration': 2.661}, {'end': 2603.067, 'text': "That's going to give us a drink object.", 'start': 2601.346, 'duration': 1.721}, {'end': 2608.049, 'text': 'And then we can just return that and build a quick dictionary.', 'start': 2603.707, 'duration': 4.342}, {'end': 2610.49, 'text': "So we'll say JSONify.", 'start': 2608.549, 'duration': 1.941}, {'end': 2612.53, 'text': "And we're going to build out the JSON.", 'start': 2611.07, 'duration': 1.46}, {'end': 2615.691, 'text': 'The key is going to be name.', 'start': 2613.05, 'duration': 2.641}, {'end': 2618.412, 'text': "That's going to come from drink.name.", 'start': 2616.432, 'duration': 1.98}, {'end': 2621.874, 'text': 'And then the second key is going to be description.', 'start': 2619.333, 'duration': 2.541}, {'end': 2626.275, 'text': "And that's going to come from drink.description.", 'start': 2622.874, 'duration': 3.401}], 'summary': 'Retrieve drink details by id and create a json object with name and description.', 'duration': 27.77, 'max_score': 2598.505, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2598505.jpg'}, {'end': 2733.868, 'src': 'embed', 'start': 2702.531, 'weight': 0, 'content': [{'end': 2705.734, 'text': 'And now I want to talk a little bit about adding a new drink.', 'start': 2702.531, 'duration': 3.203}, {'end': 2709.617, 'text': "So let's go ahead and create another route on here.", 'start': 2706.134, 'duration': 3.483}, {'end': 2711.218, 'text': "We'll say app.route.", 'start': 2710.017, 'duration': 1.201}, {'end': 2722.863, 'text': 'the path is going to be drinks and you can actually have another parameter in here, which is methods, and say post, which is good to do.', 'start': 2712.159, 'duration': 10.704}, {'end': 2726.465, 'text': "if you're defining for a post request, you can put any of the methods in here.", 'start': 2722.863, 'duration': 3.602}, {'end': 2733.868, 'text': "you could put get or delete or whatever, and you can actually condition so you could check to see what method the person's requesting.", 'start': 2726.465, 'duration': 7.403}], 'summary': 'Adding a new drink route with methods post, get, and delete.', 'duration': 31.337, 'max_score': 2702.531, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2702531.jpg'}, {'end': 3029.447, 'src': 'embed', 'start': 2998.235, 'weight': 1, 'content': [{'end': 3001.258, 'text': 'delete and pass in the drink structure.', 'start': 2998.235, 'duration': 3.023}, {'end': 3006.423, 'text': 'The best way to get this drink structure I thought would just be to get it from the database.', 'start': 3001.859, 'duration': 4.564}, {'end': 3014.23, 'text': "So we're going to create a variable drink and say drink.query.get and pass in the ID.", 'start': 3006.803, 'duration': 7.427}, {'end': 3017.433, 'text': "So I'll take the ID as a parameter from this web address.", 'start': 3014.711, 'duration': 2.722}, {'end': 3021.697, 'text': 'And then after we delete, we say db.session.commit.', 'start': 3017.854, 'duration': 3.843}, {'end': 3024, 'text': 'and I was having a little bit of an issue.', 'start': 3022.418, 'duration': 1.582}, {'end': 3029.447, 'text': "Now, in general, I haven't done a lot of like error checking and different edge cases.", 'start': 3024.06, 'duration': 5.387}], 'summary': 'Retrieve drink structure from database using id and delete it, with focus on error checking.', 'duration': 31.212, 'max_score': 2998.235, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2998235.jpg'}], 'start': 2569.379, 'title': 'Creating a python rest api', 'summary': "Covers the creation of a new method 'get drink' to retrieve drink details by id, utilizing query.get and jsonify functions, resulting in successful retrieval of drink objects and 200 ok responses. it also explains the process of creating a python rest api, including adding a new drink, handling post requests, using postman for testing, and implementing delete functionality with examples and best practices.", 'chapters': [{'end': 2702.07, 'start': 2569.379, 'title': 'Creating a method to retrieve drink details', 'summary': "Covers the creation of a new method 'get drink' to retrieve drink details by id, utilizing the query.get and jsonify functions, resulting in successful retrieval of drink objects and 200 ok responses, while also highlighting the difference in content type between json and html responses.", 'duration': 132.691, 'highlights': ["The chapter covers the creation of a new method 'get drink' to retrieve drink details by ID. The speaker introduces the creation of a new method in the code to retrieve drink details based on their ID, demonstrating the process of building and utilizing the 'get drink' method.", 'Utilizing the query.get and JSONify functions for successful retrieval of drink objects and 200 OK responses. The speaker explains the use of the query.get method to retrieve drink objects and the JSONify function to build a dictionary containing the drink details, leading to successful retrieval of drink details and 200 OK responses.', 'Highlighting the difference in content type between JSON and HTML responses. The speaker draws attention to the difference in content type between JSON and HTML responses, showcasing the response content types as application JSON and text/HTML when retrieving drink details, providing insights into the nature of different types of responses.']}, {'end': 3149.397, 'start': 2702.531, 'title': 'Creating python rest api', 'summary': 'Explains the process of creating a python rest api, including adding a new drink, handling post requests, using postman for testing, and implementing delete functionality, with examples and best practices.', 'duration': 446.866, 'highlights': ['The process of adding a new drink involves creating a separate route and method, accessing request data, adding the drink to the database, and returning the ID or a success message.', 'The usage of Postman for defining a drink in JSON format, sending a post request, and handling errors and warnings in the code.', 'Implementing a route and method for deleting a drink, including retrieving the drink structure from the database, error handling for non-existent drinks, and testing the functionality using a delete request.', 'The basics of creating a Python REST API, including functionalities for getting all drinks, adding a drink, and deleting a drink, with a mention of the simplicity of updating a drink and the complexity of building a fully functional API.']}], 'duration': 580.018, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/qbLc5a9jdXo/pics/qbLc5a9jdXo2569379.jpg', 'highlights': ['The process of adding a new drink involves creating a separate route and method, accessing request data, adding the drink to the database, and returning the ID or a success message.', 'Implementing a route and method for deleting a drink, including retrieving the drink structure from the database, error handling for non-existent drinks, and testing the functionality using a delete request.', 'Utilizing the query.get and JSONify functions for successful retrieval of drink objects and 200 OK responses.']}], 'highlights': ['The chapter covers the basics of REST APIs, including how to consume and build one in Python.', 'The importance of understanding REST API concepts and its relevance in software development is emphasized.', 'API stands for application programming interface, a means for different software applications to communicate with each other, overcoming language barriers and facilitating requests and responses.', 'JSON, or JavaScript Object Notation, is the standard language for APIs, providing a simple way to describe information using key-value pairs, and is supported in various programming languages.', 'Shared backend ensures data synchronization between front-end applications.', 'Separation of front-end and back-end allows for modularity and the ability to swap out different technologies without breaking the application.', 'Ability to expose certain endpoints as public APIs enables third-party app development and automation.', 'The backend software in Python communicates with a database where all information is stored.', 'Different API endpoints are exposed to allow communication with the backend software without direct access to the database.', "The website's purpose is to list drinks and allow users to rate them on a scale of zero to 10 or categorize them.", 'Separating client applications and the database is crucial for security, especially when using JavaScript.', 'The API allows for retrieving all drinks or a specific drink by passing an ID, which returns JSON data about the requested drink.', 'The use of authentication techniques like OAuth2 helps ensure security and control over access to the API.', 'POST is used to write new data to the server, such as adding a new resource to the database.', 'GET method is used to retrieve existing data from the server.', 'The confusion between POST and PUT in updating data, with the distinction that POST is for adding new data and PUT is for updating existing data.', 'The PUT method in an API is designed to give the same result every time if the same request is made, allowing for multiple executions without side effects.', "The term 'idempotent' is used to describe the guaranteed behavior of the PUT method, ensuring consistent results with repeated executions.", 'The tutorial suggests the potential of building an application to identify unanswered Stack Overflow questions, with the option to filter questions based on criteria such as the answer count.', "The chapter covers working with API in Python using Postman to send requests and manipulate JSON data, and installing and using the 'requests' library to make web requests, as well as parsing the JSON response.", 'The chapter demonstrates how to retrieve and filter data from a JSON response in Python, showing the process of accessing all the data, zooming in on specific items, and iterating through a list of questions.', 'Postman is recommended as a tool for working with APIs, providing the ability to customize request bodies and headers for easier API interaction.', 'Introduction to consuming an existing API from Stack Overflow The transcript introduces the process of consuming an existing API from Stack Overflow and the potential application development using its data.', 'Creating a drink model and setting up a database using SQLite, including defining the repr method, setting up the SQL Alchemy, configuring the database, creating and adding drinks to the database, and building a route to display the drinks in a JSON format.', 'Setting up SQL Alchemy and configuring the database by providing the URI for an SQLite database called data.db in the same directory.', 'Creating and adding drinks to the database by passing in data to create a drink using named parameters, adding the drink to the database using db.session.addDrink, and committing the changes using db.session.commit.', 'Building a route to display the drinks in a JSON format by iterating through the drinks, creating a list of dictionaries containing the drink data, and displaying the output as a list of dictionaries, making it serializable and accessible in a JSON format.', "Setting up a virtual environment and isolating dependencies for the specific application using the command 'python3 -m venv .venv' to isolate dependencies, ensuring the specific application's dependencies are isolated for future use.", 'Activating the virtual environment and installing dependencies using pip3 after creating the virtual environment, ensuring that all project dependencies are documented for future use.', "Managing dependencies using a requirements.txt file by outputting the dependencies to a file using 'pip3 freeze' and redirecting the output to a 'requirements.txt' file.", 'The process of adding a new drink involves creating a separate route and method, accessing request data, adding the drink to the database, and returning the ID or a success message.', 'Implementing a route and method for deleting a drink, including retrieving the drink structure from the database, error handling for non-existent drinks, and testing the functionality using a delete request.', 'Utilizing the query.get and JSONify functions for successful retrieval of drink objects and 200 OK responses.']}