Consuming HTTP Services in Python Transcripts
Chapter: Consuming RESTful HTTP services
Lecture: Introducing the Talk Python blog service

Login or purchase this course to watch this video and the rest of the course contents.
0:02 Now, one of the challenges of writing this course is if we are going to modify data out on the internet,
0:10 we are probably going to need to create an account and do all sorts of stuff with various people's APIs
0:16 and I know that those APIs might change over time and I don't necessarily want to ask everyone to go create a github API
0:24 and the access key and maybe modify their own github data that might go terribly wrong somehow, I don't know how,
0:30 but I just don't want to depend on these other services, and it's totally easy to find read only services out there
0:35 that are publicly accessible without authentication. But, as we get into more complicated, more realistic interactions,
0:41 we are going to need something we can binge on without that changing and without that ever becoming a problem.
0:49 So I'd like to introduce you to the service that we are going to use
0:52 for much of the rest of this course, now this service has at least three aspects to it, we have this blog API here and as you can guess,
1:00 we are going to just model a blog but it could be anything right, the blog part is just something to make it concrete.
1:07 Here is an http somewhat restful service and this is publicly accessible, so if I click this we get Json back, now we also have a restricted version,
1:15 we are not going to talk about authentication now, that is its own section,
1:19 but when we get to it, you are going to see that this service requires basic authentication
1:24 and so we'll learn how to do that from Python, how to access that service. we have not entered, by the way, if you want to see what it looks like,
1:33 there is username and password it looks like this one, it just won't let you access it without logging in.
1:38 So down here I have outlined the various operations, like you can get all the post from the blog like this,
1:43 you can you can get a particular blog post by going to api/blog/post id 7 or whatever,
1:48 you can create a new blog post by doing an http post to /api/blog, you can update an existing post by doing a put to that blog's specific resource id
2:01 or that url that goes to that blog and similarly you can delete it. Also we have a Soap service here,
2:08 now we are going to leave the Soap stuff to its own section, just like we are authentication but the same service,
2:13 the same set of services I guess we should call them, will do Soap, so if we click on here you can see all the crazy stuff,
2:20 we'll talk about what that means later but you can see that there is a set of operations that we can work with
2:26 here that are more Soap service like, they work in terms of nouns and actions,
2:29 and they return rich objects as real objects, we'll come back to that so for now,
2:35 what we are going to do is we are going to focus on api/blog and these operations. This is publicly accessible,
2:47 and you will be allowed without even logging in to modify the data here. It works in a pretty constraint way, so you can create some post
2:55 and it won't be shared with other users, and they will expire after a little while, things like that.
3:01 But this is a service that you can binge on and will use for much of the rest of this course.

Talk Python's Mastodon Michael Kennedy's Mastodon