In this recipe, we will create a function to connect to the weather API and fetch the weather data for a particular city. We don't want to hardcode values such as our API keys directly in our source code. So, this recipe will also show you how to create a JSON formatted configuration file that can store different settings, such as the API key. The application will then read in the values from this configuration file at boot up and use them for the calls to the weather web services.
This recipe will be particularly useful to you whenever you want to keep configuration values separate from your code base, whether it be for security reasons or to just tweak these settings more easily without changing your application's source code. This can also help you in your own projects to organize the API calls into reusable functions...