用Python发送Netscape Cookie

时间:2016-06-23 07:57:27

标签: python cookies python-requests pycurl

如何将Netscape cookie从文件加载到auth到网站REST API 与python请求[会话],pycurl或其他? 与curl -b $ {home} .cookie

类似
  

-b, - cookie(HTTP)将数据作为cookie传递给HTTP服务器。据推测,它是先前从服务器接收的数据   在“Set-Cookie:”行中。数据应采用格式   “NAME1 = VALUE1; NAME2 = VALUE2”。

import requests
from requests.auth import HTTPDigestAuth

proxi = {'http': 'http://proxy',
         'https': 'http://proxy'}

url = 'http://192.196.1.98:8080/a/changes/?q=status:new' 
r = requests.get(url, proxies=proxi) #cookies=cookie

print r.status_code
print r.json()
print r.headers
print r.request.headers
print r.text

0 个答案:

没有答案