1

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())
 
Pballer88
  • 23
  • 1
  • 5
  • Hi, could you provide an example where it works and one where it does not work? Kinda hard to give the correct answer without seeing the data. – bitflip Oct 01 '22 at 09:07

0 Answers0