import requests url='https://kyfw.12306.cn/otn/leftTicket/queryO?leftTicketDTO.train_date=2020-02-12&leftTicketDTO.from_station=WXH&leftTicketDTO.to_station=SZH&purpose_codes=ADULT' response = requests.get(url) result = response.json() result = result['data']['result'] print(result)
报错信息为
Traceback (most recent call last):
File "D:/BiYeSheJi_Project/query_request.py", line 57, in <module>
query(2020-2-23, 'BJP', 'TJP')
File "D:/BiYeSheJi_Project/query_request.py", line 29, in query
result = response.json()
File "H:\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "H:\Microsoft Visual Studio\Shared\Python36_64\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "H:\Microsoft Visual Studio\Shared\Python36_64\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "H:\Microsoft Visual Studio\Shared\Python36_64\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)