From the course: Intermediate Python for Non-Programmers
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Requests and PIP - Python Tutorial
From the course: Intermediate Python for Non-Programmers
Requests and PIP
- [Instructor] So it's great that we're getting data from our API, but the question is, how do we get this data inside of our Python code? I mean, right now, we have this URL that we can type into any browser and it's going to spit back this JSON information, but how do we actually do this in our Python code? Well, one of the ways to do this is to import some code into our project that's going to make it really easy, and we're going to use something called pip in order to do that. So let's go ahead and start a new file for this project. So I'm going to open up Adam here, and I'm going to create a new file and I'm going to save this, and I'm going to call it weather.py. And inside of this weather.py, I'm going to import a package called requests. And requests is this library of code that makes it so easy to just put in a URL and get back the information from that URL. So, we're just going to type all lowercase import requests just like that, and we'll go ahead and hit Save. And let's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.