That itch you can’t scratch

david hong
Feb 23, 2017 · 1 min read

aka Curiosity.

Or in my case, curiosity = frustration.

Recently, I’ve been dealing with an issue at my job (which is a whole ‘nother topic of discussion!) where a client is running into issues with one of our API’s.

This incident triggered that little voice in my head that tells me to try and replicate what they’re doing with their code, but in my own shitty way. I could have just kicked it over to another team to handle the problem and called it a day.

But I didn’t. At least I didn’t wipe my hands of it like the grease from a great burger. (Cue images of Dick’s Drive In burgers floating around like little cherubs.)

I spent the next couple of days, whenever I had some free time, digging into Python and the Requests module. Previously, I had written a mish-mash of a shell script that contained within in Python. But I wanted to see if I could do it all in Python this time around.

And guess what, I did.

It wasn’t pretty. It’s probably not the most efficient code. But I wrote something from start to finish that does exactly what I set out to do.

Utilmately, I was able to do the following:

  1. Authenticate with the API
  2. Capture the HTTP status codes
  3. Request a specific report via the API and save output to text file

Link to repo: https://github.com/dh0ng/reportingApi-test

david hong

Written by

All things Tech & Digital/Emerging media excite me! Entreprenurship tickles my fancy. Wanna-be Coder based in Seattle.