我想从一个网站检索一个JSON,但不知何故它不工作。我可以在网站上看到JSON(开发人员工具)并验证它,一切都很好。
下面是我的代码:
import requests
from requests.exceptions import HTTPError
try:
response = requests.get('https://www.landal.de/parks/beach-park-texel/unterkunfte/4bl')
response.raise_for_status()
# access JSOn content
jsonResponse = response.json()
print("Entire JSON response")
print(jsonResponse)
except HTTPError as http_err:
print(f'HTTP error occurred: {http_err}')
except Exception as err:
print(f'Other error occurred: {err}')
错误如下:
Other error occurred: Expecting value: line 2 column 1 (char 2)
当我读了很多问题,我感觉这是网站。
1条答案
按热度按时间doinxwow1#
要从页面中获取JSON数据,请使用
POST
和payload:图纸: