|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
为什么同一行代码运行的结果每次都不一样,但是出错都是这个原因
代码是这样的
while Ture:
url="http://www.nffund.com/QueryFundNoticeServlet?fundcode={0}&infoType=&type=0&title=&pageNo={1}&pageSize=15".format(fundcode,pageNo)
print(url)
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'}
response = requests.get(url=url,headers=headers)
data = json.loads(response.text)
运行结果有:
http://www.nffund.com/QueryFundN ... 1&pageSize=1000
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
================== RESTART: C:\Users\lenovo\Desktop\111.py ==================
http://www.nffund.com/QueryFundN ... o=1&pageSize=15
http://www.nffund.com/QueryFundN ... o=2&pageSize=15
http://www.nffund.com/QueryFundN ... o=3&pageSize=15
http://www.nffund.com/QueryFundN ... o=4&pageSize=15
http://www.nffund.com/QueryFundN ... o=5&pageSize=15
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
================== RESTART: C:\Users\lenovo\Desktop\111.py ==================
http://www.nffund.com/QueryFundN ... o=1&pageSize=15
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
================== RESTART: C:\Users\lenovo\Desktop\111.py ==================
http://www.nffund.com/QueryFundN ... o=1&pageSize=15
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
================== RESTART: C:\Users\lenovo\Desktop\111.py ==================
http://www.nffund.com/QueryFundN ... o=1&pageSize=15
http://www.nffund.com/QueryFundN ... o=2&pageSize=15
http://www.nffund.com/QueryFundN ... o=3&pageSize=15
http://www.nffund.com/QueryFundN ... o=4&pageSize=15
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
================== RESTART: C:\Users\lenovo\Desktop\111.py ==================
http://www.nffund.com/QueryFundN ... o=1&pageSize=15
http://www.nffund.com/QueryFundN ... o=2&pageSize=15
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\111.py", line 146, in <module>
get_the_fund_list(address_in,address_out)
File "C:\Users\lenovo\Desktop\111.py", line 24, in get_the_fund_list
DF1=get_the_Fund_Bulletin_address(fund)
File "C:\Users\lenovo\Desktop\111.py", line 54, in get_the_Fund_Bulletin_address
data = json.loads(response.text)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
|
|