Using the requests package, I'm looking to loop through API calls, return JSON responses, and append the responses to a list. The for loop is failing because some of the responses are returning NULL responses. How can I skip past the NULL responses in my for loop? I'm getting the following error:
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I've tried changing the response property from .json to .text as a workaround, but I get the following error:
str' object is not callable
The for loop:
Cfinancials_all = []
for i in companyfinancials_links:
ddr = requests.get(i, headers=headers, data=payload)
print(ddr.json())