#100DaysOfCode in Python Transcripts
Chapter: Days 97-99: Building JSON APIs
Lecture: Making the client self-validating

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So we're over here, and we're calling service all_rolls, and then we have to, remember you have to basically say,
0:08 service.all_rolls. Store that," and another thing you have to say, raise_for_status and then call JSON if that worked. So that was really cumbersome.
0:21 So we created this thing called The uplink_helpers, which had this basically uplink response handler raise_for_status.
0:33 So if we go over here to our game, oh sorry, api, excuse me, and we say this, then it won't let any code through that fails.
0:43 So we know that it's safe to say .json right here, 'cause it's already tested it. We can do better though.
0:49 We make it all of these methods return the dot. JSON will response a result by adding one other thing. This response to data.
0:57 So given a response, we just call response.json. Otherwise, they throw a format error. If we also put this at the top, on the outside, not the inside.
1:09 The outside; That's important. And this one goes on the inside. Then we can come down here, and just print this.
1:16 And we should be our little devil, all the various pieces. We do. Very nice. So I feel like our game service is in place,
1:24 and that really makes working with it nice and easy.


Talk Python's Mastodon Michael Kennedy's Mastodon