Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
JSONDecodeError on PythonAnywhere

I'm trying to deploy my app on PythonAnywhere. Everything is running ok, but when I call a function, my app fails.

Exception Type: JSONDecodeError Exception Value: Expecting value: line 1 column 1 (char 0)

Error Imgur image part 1

Error Imgur image part 2

I have been reading another answers, but no one is working for me. The problem is this piece of code:

        parametros = {'location': lugar, 'API_KEY': api_code}
        url = 'http://servizos.meteogalicia.es/apiv3/findPlaces'

        # Enviamos la peticion
        peticion = requests.get(url, parametros)

        # Obtenemos la respuesta
        respuesta = json.loads(peticion.text)

UPDATE 1

The same error:

        parametros = {'location': lugar, 'API_KEY': api_code, 'format': 'application/json'}
        url = 'http://servizos.meteogalicia.es/apiv3/findPlaces'

        # Enviamos la peticion
        try:
            peticion = requests.get(url, parametros)
        except:
            peticion.raise_for_status()

        # Obtenemos la respuesta
        respuesta = json.loads(peticion.text)

And the JSON seems to be valid:

JSON validation

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

(Posted on behalf of the OP).

I received this support message, so the problem is solved:

Ah! Sorry, I really should have spotted that first. Free users are restricted to accessing sites on a whitelist of websites with official documented APIs, and for some reason I thought the site was already on the whitelist.

I'll add it now and let you know when it's active.

about 4 years ago · Santiago Trujillo Report

0

The problem is probably here:

File "./consulta/views.py" in formulario
  32.             respuesta = json.loads(peticion.text)

It seems that peticion.text is not a valid JSON string.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!