0
I’m collecting data from an Api that retrieves the information in a Json dictionary to play on an appweb so the server gives me this error how can I fix it?
Mistake you’re making:
Traceback (most recent call last):
File "/home/dalmo/mysite/models/database.py", line 25, in <module>
BancoDados.total()
File "/home/dalmo/mysite/models/database.py", line 23, in total
return BancoDados.Expert() + BancoDados.TS1()
File "/home/dalmo/mysite/models/database.py", line 10, in Expert
respo = json.loads(str(url.text))
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
My code:
import requests
import json
class BancoDados:
def Expert():
url = requests.get('http://infinite-flight-public-api.cloudapp.net/v1/Flights.aspx?'
'apikey=78879b1d-3ba3-47de-8e50-162f35dc6e04&sessionid=7e5dcd44-1fb5-49cc-bc2c-a9aab1f6a856')
respo = json.loads(str(url.text))
return(respo)
def TS1():
url = requests.get('http://infinite-flight-public-api.cloudapp.net/v1/Flights.aspx?'
'apikey=78879b1d-3ba3-47de-8e50-162f35dc6e04&sessionid=6a04ffe8-765a-4925-af26-d88029eeadba')
respo = json.loads(str(url.text))
return(respo)
def total ():
return BancoDados.Expert() + BancoDados.TS1()
BancoDados.total()
You should put the complete error with traceback, in text format, not image. Edith the question and add the error in text. Also put the relevant part of your code.
– nosklo