from selenium import webdriver import requests def loginZhihu(): loginurl = 'https://www.zhihu.com/signin' driver = webdriver.Chrome() driver.get(loginurl) #生物智能在干活当中............. input('pending.........') driver.refresh() Zcookie = [item["name"] + "=" + item["value"] for item in driver.get_cookies()] driver.close() cookiestr = ';'.join(item for item in Zcookie) headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36", "Cookie": cookiestr} a=requests.get('https://www.zhihu.com/people/edit', headers=headers) print(a.text) print(a.status_code,'_____________________') return True loginZhihu()