Visit all pycons in europe
Level: Intermediate (score: 3)
In Bite 256 you scraped data on 2019 PyCons. Now it's time to go there! In this Bite you enrich the data with geographical information and create a travel plan to visit all the PyCons! This will involve using some data from an geographical information API.
First you have to collect the rough geographical location data for the different PyCons. An excellent source for such data is OpenStreetMaps. You will use data from the Nominatim API to complete the update_pycons_lat_lon
function which updates the PyCon data with latitude and longitude of the corresponding city.
For example, if you want to get information on Munich you can use this query which asks for the city and country q=Munich,Germany
, the format &format=json
and the output language &accept-language=en
.
Due to limitations of API calls (max. one call per second), we stored the required requests in the nominatim_responses.json
file. The JSON file holds the query url as the key
to the response data (nested dict
). If you are interested in details on the online API see the this page.
After you retrieved and updated the information, plan your journey by completing the create_travel_plan
function. Here you want to bring the PyCons in the right order as you won't be able to visit PyCons that lie in the past :) For ordering assume it's now the start of 2019.
Finally, complete the total_travel_distance
function which takes your journey from the create_travel_plan
function and returns the total distance you traveled for the complete PyCon journey. For simplicity, only consider the air distance in kilometers between the PyCons using the helper function _km_distance
.
Good luck and keep calm and see you at the next PyCon events! :)