复制代码
import requests
def aaa():
cookies = {
'__jsluid_s': 'fc5d7cb700e08b9891cdcf95030401fd',
}
headers = {
'Host': 'weather.121.com.cn',
'Connection': 'keep-alive',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
'sec-ch-ua': '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Dest': 'image',
'Referer': 'http://weather.sz.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
'Cookie': '__jsluid_s=fc5d7cb700e08b9891cdcf95030401fd',
'Host': 'weather.121.com.cn',
'Connection': 'keep-alive',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
'sec-ch-ua': '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Dest': 'image',
'Referer': 'http://weather.sz.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
'Cookie': '__jsluid_s=fc5d7cb700e08b9891cdcf95030401fd',
}
params = {
'source': 'pc',
'gdbsuser': '9c1bc19da29f4131bc4d3d6a26599559',
'r': '1699018207264',
}
response = requests.get(
'https://weather.121.com.cn/szqx/api/twt/kfr/gryy/code.do',
params=params,
cookies=cookies,
headers=headers,
)
return response.content