正在使用python模块请求为网页发送接收cookie以进行登录。我检索了cookie但是当我发回它时,过期日期格式似乎很复杂......任何提示?
import requests
urlDelete = "https://10.10.7.5/nf/alerts"
urlLogin = "https://10.10.7.5/LOGIN"
params = {'credential_0': 'xxx', 'credential_1': 'xyxy',
'destination': '//', 'login': 'Log In'}
r = requests.post(urlLogin, data=params, verify=False)
r2 = requests.post(urlDelete, verify=False, cookies=r.cookies)
print(r2)
print(r2.headers)
我的Cookie值:
<bound method RequestsCookieJar.values of <RequestsCookieJar[Cookie(version=0, name='Mercury::Handler::AuthCookieHandler_AMPAuth', value='5da5f9149b26c08ecaa721a95328962a', port=None, port_specified=False, domain='10.10.7.5', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=True, expires=1425781296, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]>>
我的标题回复:
{'Cache-control': 'no-cache,max-age=30,must-revalidate',
'Connection': 'Keep-Alive',
'Content-Length': '3780',
'Content-Type': 'text/html; charset=utf-8',
'Date': 'Sun, 08 Feb 2015 01:13:23 GMT',
'Keep-Alive': 'timeout=15, max=100',
'Pragma': 'no-cache',
'Server': 'Apache',
'Set-Cookie': 'Mercury::Handler::AuthCookieHandler_AMPAuth=; expires=Mon, 21-May-1971 00:00:00 GMT; path=/; secure;HttpOnly, Mercury::Handler::AuthCookieHandler_AMPAuth=; expires=Mon, 21-May-1971 00:00:00 GMT; path=/; secure;HttpOnly',
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
'X-CONTENT-TYPE-OPTIONS': 'nosniff',
'X-Frame-Options': 'SAMEORIGIN'}