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
0:05 if we are going to modify data out on the internet,
0:09 we are probably going to need to create an account
0:12 and do all sorts of stuff with various people's APIs
0:15 and I know that those APIs might change over time
0:18 and I don't necessarily want to ask everyone to go create a github API
0:23 and the access key and maybe modify their own github data
0:27 that might go terribly wrong somehow, I don't know how,
0:29 but I just don't want to depend on these other services,
0:31 and it's totally easy to find read only services out there
0:34 that are publicly accessible without authentication.
0:37 But, as we get into more complicated, more realistic interactions,
0:40 we are going to need something we can binge on without that changing
0:45 and without that ever becoming a problem.
0:48 So I'd like to introduce you to the service that we are going to use
0:51 for much of the rest of this course, now this service has at least three aspects to it,
0:56 we have this blog API here and as you can guess,
0:59 we are going to just model a blog but it could be anything right,
1:03 the blog part is just something to make it concrete.
1:06 Here is an http somewhat restful service and this is publicly accessible,
1:10 so if I click this we get Json back, now we also have a restricted version,
1:14 we are not going to talk about authentication now, that is its own section,
1:18 but when we get to it, you are going to see that this service requires basic authentication
1:23 and so we'll learn how to do that from Python, how to access that service.
1:28 we have not entered, by the way, if you want to see what it looks like,
1:32 there is username and password it looks like this one,
1:35 it just won't let you access it without logging in.
1:37 So down here I have outlined the various operations,
1:39 like you can get all the post from the blog like this,
1:42 you can you can get a particular blog post by going to api/blog/post id 7 or whatever,
1:47 you can create a new blog post by doing an http post to /api/blog,
1:53 you can update an existing post by doing a put to that blog's specific resource id
2:00 or that url that goes to that blog and similarly you can delete it.
2:04 Also we have a Soap service here,
2:07 now we are going to leave the Soap stuff to its own section,
2:10 just like we are authentication but the same service,
2:12 the same set of services I guess we should call them, will do Soap,
2:16 so if we click on here you can see all the crazy stuff,
2:19 we'll talk about what that means later but you can see
2:22 that there is a set of operations that we can work with
2:25 here that are more Soap service like, they work in terms of nouns and actions,
2:28 and they return rich objects as real objects, we'll come back to that so for now,
2:34 what we are going to do is we are going to focus on api/blog and these operations.
2:38 This is publicly accessible, consumer_services_api.talkpython.fm
2:46 and you will be allowed without even logging in to modify the data here.
2:51 It works in a pretty constraint way, so you can create some post
2:54 and it won't be shared with other users,
2:57 and they will expire after a little while, things like that.
3:00 But this is a service that you can binge on and will use for much of the rest of this course.