59骚操作脏数据

This commit is contained in:
luzhisheng 2023-02-06 15:55:55 +08:00
parent 2d06f4cc16
commit eae820979e
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import json
import requests
def challenge59(page):
url = "https://www.python-spider.com/api/challenge59"
payload = f"page={page}"
session = requests.session()
headers = {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
session.headers = headers
response = session.request("POST", url, data=payload)
return response.text
def run():
data_num = 0
for page in range(1, 101):
res_dict = json.loads(challenge59(page))
data_list = res_dict.get('data')
data_list_num = []
for data in data_list:
data_list_num.append(int(data.get('value')))
data_num += int(data.get('value'))
print(data_list_num, page)
print(data_num)
print(data_num)
if __name__ == '__main__':
run()

View File

@ -0,0 +1,3 @@
# 知识点:
## 解题思路