Code Challenge 16 - Query Your Favorite API - Review

PyBites, Sun 30 April 2017, Challenges

APIs, books, codechallenges, Flask, Forismatic, Github, Google, learning, quotes, Warcraft, Wikipedia

It's end of the week again so we review the code challenge of this week: Query Your Favorite API. It's never late to join, just fork us and start coding.



As I discussed in my post this week about learning Python, this code challenge was pretty much directed at me.

Going into this one, I'd never accessed an API in my life!

I spent the entire week playing around with different APIs but primarily the World of Warcraft and Gmail APIs.

The work with the Gmail API was great learning but essentially a bust when it came to having a working script. I had an idea in mind as to what I wanted from it but I just wasn't able to get it done.

I did have a little more success with the World of Warcraft API however. I'm sure it means nothing to most of you reading this but I was able to pull down data about my player character and have it presented in a readable format. (JSON was also new to me!).

The code for this is here. As it was my first API attempt, it is definitely quite simplistic. The intention is to wrap it all up such that I can recreate my character profile locally.


I used various APIs this week:

google books autocomplete 1

When you select a title it redirects to a page where it pulls more details from the Google Books API (buttons not yet implemented):

google books autocomplete 2


We got 2 cool Pull Requests. We are really stoked you submit code to our repo. Good work folks, keep up the momentum!


Martin submitted a cool project called GitHub-Profiler where he queries the Github API for a given user, entering 'pybites' it generates this nice page, awesome:

github api 1

If bio and repos was not enough, scrolling towards the end it also lists gists:

github api 2

Code merged on our community branch.


Another usage of APIs we got from Dante who used the Forismatic API to pull random quotes. The author's bio gets crawled from Wikipedia, really nice:

Forismatic api 1

When you hit "Another Quote!" the page refreshes and shows another random quote and its author + bio:

Forismatic api 2

Code merged on our community branch.

We hope you are enjoying these challenges, learning along the way. Let us know if you have any issue and/or contact us if you want to submit a cool challenge. See you next week ...

Keep Calm and Code in Python!

-- Bob and Julian

PyBites Python Tips

Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.

Get our Python Tips Book

"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H

"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B

"This is now my favourite first Python go-to reference." - Anthony L

"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S

Get the book