Release 0.2 Part 2: Just a little bit more
Tags: opensource
Published: 2020-10-27 02:43:39

This blog post is really late, and I'm sorry about that, David. But trust me when I say, I will at least have this and the rest of my PRs done by this October, I promise! :D

Last time, we tricked out Axios to a react-github-resume project. I enjoyed working with Axios and fully plan to implement it for my capstone project this semester when I work out the front-end later next month. Anyway, for this PR, I worked on something a little bit similar but with a different language. I made a script in Python that accepts mandatory arguments, retrieves data from the Github API once again, and writes the output to a text file. The main difference here is that I'm using Python. Outside of the http requests I've done in my release 0.1 project, I haven't messed around with http stuff in Python. I'm aware of Django and Flask and wanna eventually work on some stuff using that so understanding how requests were done in PYthon compared to Javascript is something I was interested in.

The file wasn't anything too simple. The main work for me was trying to figure out how to extract the data. It's naturally similar to Javascript in that I need to call the .json() method of the requests library (which I used over urllib3 but honestly, either one works here).  

![requestsJsonMethod](https://dev-to-uploads.s3.amazonaws.com/i/qcbu6thfmm0l61z2i1jo.png)

What surprised me, though, was how you access object's value in Python compared to Javascript. In Javascript, you could do this with fetch (Done differently with Axios but same concept)

![FetchJavascript](https://dev-to-uploads.s3.amazonaws.com/i/2o2n05wk1wlnqiafuzpe.png)

In Python, objects are known as "Dicts" which works similar to a hashmap. You provide a key, and retrieve the value from there. They also have a .get() method which works the same way

![PythonDictGet](https://dev-to-uploads.s3.amazonaws.com/i/o693hifxui30sazxs2oe.png)

This confused me at first, but after reading the docs for Python, I learned about this difference. The rest was just grabbing the list of contributors, storing them in an array, then writing the output to a file that would be generated in the directory the script is ran in if one does not currently exist, otherwise, it will be overwritten.

![FinalTouches](https://dev-to-uploads.s3.amazonaws.com/i/6qw6xd3ahjv83u3bdgb0.png)

I pushed my script to my forked repo and made the PR. The author requested that I make a README.md which made lots of sense so I did that and pushed that file as well

![RequestedChanges](https://dev-to-uploads.s3.amazonaws.com/i/6g6piaabc1ptw4z5916e.png)

This PR, while a step-up from what I did in my previous PR, helped me alot in learning more about Python as well as what to do whenever a change is requested. Until this point, all my PRs were accepted without review. This PR changes that. Reviewing is something I need to continue to practice with and is something I'm looking forward to with the last 2 releases for the next 2 months. Here's the PR too btw, for those wondering:

https://github.com/avinashkranjan/Amazing-Python-Scripts/pull/127

Next time, 2 PRs left to finish with about 5 days left. A race against the clock. Enjoy the ride!

On a side-note, the workload for me was crazy the last two weeks. I'll need to manage my time more effectively so that this situation does not come up often. I believe in finishing stuff on time, so although I will 100% be losing marks, as long as I learn something from this work, that's all that matters to me. Take care everyone!