This is a simple app for me to get used to APIs in Python. I have a project idea to use an API, and it was asked that I use Python for this project.
I haven't really made much with Python, and I have never worked with APIs in Python. I thougth a simple little app for fun would be a good way to get my feet wet.
I followed along to John Watson Rooney's video: "HOW TO: JSON and APIs in PYTHON - A Beginners Look" to get an idea of how APIs in Python works.
- Uses the
requests
HTTP library that sends an HTTP/1.1 request to the API. - The API used was the Punk API.
- The Punk API has built in querying.
- I prompt the user for what type of food they are eating, and the API uses a fuzzy search to generate an array of objects.
- This array of objects is a list of beers where the food pairings given for each beer in the API is fuzzy matched to the user's input.
- Once the API finds and builds an array of beers that match the food pairing, it chooses a random one to recommend using the
random
module, and generates a random recommendation to the screen.
- This was basically the output from the video. I set up my own output however. I didn't follow the video's output example, I styled it myself.
- I didn't like the format of the output, the tagline didn't make sense the way I had it.
- I included the tagline as the initial recommendation.
- I also added the IPAs description to the output as well.