Skip to content
Advertisement

How to make multiple api calls with python requests

I am trying to make parallel calls to external apis from django using requests or any other library that allows me to do this.

I have already tried using grequests to make this calls, sometimes it works but most times I get ‘NoneType’ object has no attribute ‘json’ error on the client side. Here are my codes

views.py

JavaScript

On the server side i get this error:

JavaScript

Can I use requests or any other library to perform the calls without getting these errors? if yes how do i implement it in my work?

Advertisement

Answer

Try placing this:

JavaScript
Advertisement