gpt4 book ai didi

PythonAnywhere 上的 JSONDecodeError

转载 作者:行者123 更新时间:2023-12-05 01:12:05 26 4
gpt4 key购买 nike

我正在尝试在 PythonAnywhere 上部署我的应用程序。一切正常,但是当我调用一个函数时,我的应用程序失败了。

异常类型:JSONDecodeError
异常值:期望值:第 1 行第 1 列(字符 0)

Error Imgur image part 1

Error Imgur image part 2

我一直在阅读其他答案,但没有人为我工作。问题是这段代码:

        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)

更新 1

同样的错误:
        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)

JSON 似乎是有效的:

JSON validation

最佳答案

(代表OP发布)。
我收到了这条支持消息,所以问题解决了:

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.

关于PythonAnywhere 上的 JSONDecodeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43765522/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com