import requests
requests.packages.urllib3.disable_warnings()
url='http://guba.eastmoney.com/jj.html'
#url = "https://www.baidu.com"
Hostreferer = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36'
}
html = requests.get(url, headers=Hostreferer, verify=False)
#第一种方法
if html.status_code == 200:
    print(html.cookies)
#第二种方法
for cookie in html.cookies:
    print(str(cookie.name)+"="+str(cookie.value))