Save headers of response and request
This commit is contained in:
parent
6acfd75780
commit
058cafe69e
1 changed files with 6 additions and 0 deletions
|
|
@ -166,6 +166,12 @@ class BaseBrowser(object):
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
if response.cookies and len(response.cookies):
|
if response.cookies and len(response.cookies):
|
||||||
WeboobCookieJar.from_cookiejar(response.cookies).export(response_filepath + '-cookies.txt')
|
WeboobCookieJar.from_cookiejar(response.cookies).export(response_filepath + '-cookies.txt')
|
||||||
|
with open(response_filepath + '-request.txt', 'w') as f:
|
||||||
|
for key, value in response.request.headers.iteritems():
|
||||||
|
f.write('%s: %s\n' % (key, value))
|
||||||
|
with open(response_filepath + '-response.txt', 'w') as f:
|
||||||
|
for key, value in response.headers.iteritems():
|
||||||
|
f.write('%s: %s\n' % (key, value))
|
||||||
|
|
||||||
match_filepath = os.path.join(self.responses_dirname, 'url_response_match.txt')
|
match_filepath = os.path.join(self.responses_dirname, 'url_response_match.txt')
|
||||||
with open(match_filepath, 'a') as f:
|
with open(match_filepath, 'a') as f:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue