13 out of 15 users completed this Bite ...
Will you be Pythonista #14 to crack this Bite?
Average Bite difficulty 1-10 rating: 1.0
» You can do it! 😌
In this Bite you will use the
requestslibrary to make a GET request to the ipinfo service.
IPINFO_URLand parse the (2 char) country code from the obtained json response.
Note how we mocked out the
requests.getcall in the tests, you can see another example of this in our Parsing Twitter Geo Data and Mocking API Calls by Example article.
Querying APIs is a common need so this should become second nature :) - enjoy!