mirror of
https://github.com/httpie/cli.git
synced 2025-01-24 06:19:12 +01:00
Simplified stored session cookie data.
This commit is contained in:
parent
4c45f0d91f
commit
5f42a21cfb
@ -154,20 +154,15 @@ class Session(BaseConfigDict):
|
|||||||
@cookies.setter
|
@cookies.setter
|
||||||
def cookies(self, jar):
|
def cookies(self, jar):
|
||||||
# http://docs.python.org/2/library/cookielib.html#cookie-objects
|
# http://docs.python.org/2/library/cookielib.html#cookie-objects
|
||||||
excluded = [
|
stored_attrs = ['value', 'path', 'secure', 'expires']
|
||||||
'_rest', 'name', 'port_specified',
|
|
||||||
'domain_specified', 'domain_initial_dot',
|
|
||||||
'path_specified', 'comment', 'comment_url',
|
|
||||||
]
|
|
||||||
self['cookies'] = {}
|
self['cookies'] = {}
|
||||||
for host in jar._cookies.values():
|
for host in jar._cookies.values():
|
||||||
for path in host.values():
|
for path in host.values():
|
||||||
for name, cookie in path.items():
|
for name, cookie in path.items():
|
||||||
cookie_dict = {}
|
self['cookies'][name] = dict(
|
||||||
for k, v in cookie.__dict__.items():
|
(attname, getattr(cookie, attname))
|
||||||
if k not in excluded:
|
for attname in stored_attrs
|
||||||
cookie_dict[k] = v
|
)
|
||||||
self['cookies'][name] = cookie_dict
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def auth(self):
|
def auth(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user