From the course: Using Python for Automation (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating API requests

Creating API requests

- [Instructor] Let's check out the first step of using APIs, creating the request. To practice, we'll be using this free API on upcitemdb.com. This software translates barcodes into a whole host of information, including the product's name and brand. To see an example of what an API call should look like, let's go ahead and use their online GUI I've pulled up here. To demo, I'll just use a LaCroix can barcode. This is a lot of information to break down. But for now, let's just focus at the request URL line at the top. This line contains two factors, the base URL, or everything preceding the question mark, and the parameters of the API call, or everything after the question mark. The base URL is independent of our parameters and will be the same for any barcode we'll look up. However, on the other hand, the parameters are specific to this barcode search. This may sounds complex but this breaks down very simply into code. Let me show you. Let's start by…

Contents