import requests
import json
import math
url = 'https://xueqiu.com/service/v5/stock/screener/quote/list'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36'
}
params = {
'page': '1',
'size': '30',
'order': 'desc',
'orderby': 'percent',
'order_by': 'percent',
'market': 'HK',
'type': 'hk',
'_': '1566213291032'
}
def send_request():
response = requests.get(url=url,headers=headers,params=params)
print(response.url)
print(response.status_code)
if response.status_code == 200:
return response
def paese_data(response):
print(response.text)
data = json.loads(response.text)
list = data.get('data').get('list')
for i in list:
print(i)
if __name__ == '__main__':
response = requests.get(
url=url,
headers=headers,
params=params
)
if response.status_code == 200:
print('请求成功')
print(response.text)
data = json.loads(response.text)
page_data = data.get('data')
page_num = math.ceil(page_data.get('count')/30)
for p in range(1,page_num + 1):
print(p)
data['page'] = str(p)
response = send_request()
paese_data(response)
爬取雪球网 泸深股市 代码
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...