Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda