One of the challenges many of us come across when taking a more automated approach to infrastructure is the sheer number of tools available. This is especially true when you come from a one tool for multiple roles environment. Every week, there appears to be another tool for you to choose from. Finding where to start is quite daunting, and the opinions of others leads to much second guessing. One of the lessons that would have helped me earlier on, is understanding what the role of a specific tool is and how it fits into the overall process.
If you';re looking at Python to interact with API';s, it';s likely that you';ll use the Requests module. Many platforms also offer SDK';s to help. Such as, Boto3 which is the AWS Python SDK. Requests is very well documented, both official and community documentation. The official site for Requests is http://docs.python-requests.org/en/master/ In this post, we are going to cover the basics of performing a HTTP GET and working with the data.
Boto3 was my first real attempt to work with an API interface. At the start, I had difficulty using the API response. This was partly due to only light exposure to Python. Also, an incorrect understanding of what the response was. When people talk about APIs, it';s hard to go a minute without hearing “JSON format';. I had seen JSON formatted text before. Combining this, with documentation displaying API call response in JSON formation, lead to a 2+2=5 scenario.