Okay, so yesterday I was messing around trying to pull player stats for a New Orleans Pelicans vs. Clippers game. Figured it’d be a fun little project, and maybe I could even learn something new.

First thing I did was jump online and start searching for APIs that might have this kind of data. I stumbled upon a few different options, but some looked kinda sketchy, and others wanted you to sell your grandma for access. So I ended up using a free one that seemed decent enough for what I needed. I won’t name it, but let’s just say it wasn’t the prettiest API out there.
After that, I fired up my code editor (VS Code, naturally) and started a new Python script. I know, I know, Python is like the duct tape of programming, but it gets the job done, right? I imported the requests
library because, duh, I needed to make API calls. I also grabbed json
to deal with the data that would be coming back.
Then came the fun part: actually crafting the API request. I had to figure out the right endpoint, the right parameters, all that jazz. It took a bit of trial and error, honestly. The API documentation wasn’t exactly a work of art. I kept getting 404 errors or weird data formats. But eventually, I figured out the magic incantation to get the player stats for the specific game I wanted.
Once I got a response, it was a big, ugly JSON blob. So, I used to turn it into a Python dictionary. Then, I started digging through the layers of nested data to find the actual player stats. This part was kinda tedious. It felt like I was spelunking in a digital cave.
After what felt like an eternity, I finally managed to extract the stats I cared about: player name, points, rebounds, assists, you know, the usual suspects. I looped through the JSON, pulled out each player’s data, and stashed it into a list of dictionaries. Think of it like a digital spreadsheet.
Now that I had the data, I wanted to do something with it. So, I decided to print it out in a nice, readable format. Nothing fancy, just a simple table-like output to the console using Python’s f-strings for formatting. I made sure to include the team names too, so I knew who was who.
Finally, I ran the script, and bam! There it was: player stats for the Pelicans vs. Clippers game, all neatly printed out. It wasn’t perfect, but it worked. I even tried tweaking the script to calculate some simple stats like total points per team. It was a fun little exercise, and I definitely learned a thing or two about working with APIs and handling JSON data. Next time, maybe I’ll try something even more complicated, like saving the data to a database or building a simple web app to display it. Who knows?