Sixth-week blog post for GSoC 2021

LeoCumpli21
Published: 07/13/2021

Welcome to my sixth blog post about my experience in Google Summer of Code (GSoC) 2021.

What am I working on

Last week I finished working with my second milestone. This is what I did. There is a lecture in the project called Hackeando con Pyhton that is supposed to teach how to access an API and retrieve information using pyhton. Before last week, this lecture had only one exercise because others were eliminated due to the APIs they used (They have changed a lot and they are no longer public). Now, this lecture has six new exercises.
You might know these two python modules to do HTTP requests: urllib and requests. For the new exercises I used both, mainly because I encountered a problem with Runestone and I had to change the python interpreter to solve this.
This week I will be working on my third milestone.

What have I struggled with this week?

I had trouble with the dumps method from the json module. For an exercise I needed to display on screen the json data retrieved from an API. In order to print it with indentation I passed the indent argument. Like this:
print(json.dumps(datos, indent=4))
However, it wasn't working.

What solutions have I found?

So, I was using requests module before this. I had to change the python interpreter to brython for some exercises, because in Brython json.dumps with the indent arg works just fine, but Brython doesn't support the requests module yet. This is why I changed to urllib. In the Brython's console, the output finally dislplayed nicely with indentation.