Consuming HTTP Services in Python Transcripts
Chapter: The service landscape
Lecture: Service type: HTTP and REST

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, next up, the majority of services that you are going to see, are going to be HTTP restful services.
0:07 Be careful using the word restful because just certain people restful means very specific set of criteria,
0:14 that most HTTP Json based services don't actually meet. Maybe they are 75% restful or whatever, so I am going to try to use HTTP services
0:23 but these are more or less restful services for their features, even if they are not entirely complete.
0:30 So how does this work, well, we have our app, and again we are going to do an HTTP request and again, this is going to go over HTTP
0:35 but this time it's going to be a get request and it's going to be a get request against something that is a noun not a verb.
0:42 And this time we are going to request API/users/7 indicating we want the details about user 7 and what we are going to get back
0:49 from the server, is going to be a Json message with the name Michael and id 7, presumably, we even get more information,
0:58 but just keeping it simple for the slides here. So what are the benefits? Well, there are many.
1:03 This is universally accessible, this service is universally accessible, almost every platform has decent support for basic HTTP string exchange.
1:14 This is super easy to do from Python, this is super easy to do from Javascript, as well as C, ObjectiveC, swift, you name it, we can call this function
1:24 from basically anything that will talk to a network. Because it's HTTP and it follows the get post put standard HTTP verbs,
1:32 it's firewall friendly, proxy friendly and for example this request is potentially cashable.
1:37 Reading this message name Michael id 7, is ridiculously easy, it's entirely human readable, and while it's not as light weight
1:46 as the binary exchange it's dramatically more lightweight than what we would get if this was a Soap message,
1:54 I've put this in the relatively light weight bandwidth story. There is some drawbacks, it's often that you will find these services
2:03 that are not self-describing, there is some tooling called swagger that you can add to the server's side and then use some tooling on the client side
2:10 to help describe and generate proxies and things like that but, generally speaking, these services are not self-describing and like I said,
2:18 if the thing you are absolutely maximizing is bandwidth exchange, well maybe raw sockets would be that, but if it's got to go over the internet,
2:26 this is about as good as it's going to get.


Talk Python's Mastodon Michael Kennedy's Mastodon