DEV Community

Leonardo Cumplido
Leonardo Cumplido

Posted on

1 1

Sixth-week blog post for PSF, GSoC 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))
Enter fullscreen mode Exit fullscreen mode

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.

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay