Permalink
Browse files

Write request headers to .log files in log_dir if debug option is ena…

…bled
  • Loading branch information...
1 parent 7895977 commit b977511752b8e0cb4b5404366a366917c74da146 @lorien committed Oct 3, 2011
Showing with 8 additions and 2 deletions.
  1. +7 −1 grab/grab.py
  2. +1 −1 setup.py
View
@@ -405,7 +405,13 @@ def save_dumps(self):
else:
tname = '-%s' % tname
fname = os.path.join(self.config['log_dir'], '%02d%s.log' % (self.request_counter, tname))
- open(fname, 'w').write(self.response.head)
+ with open(fname, 'w') as out:
+ if self.config['debug']:
+ out.write('Request:\n')
+ out.write(self.request_head)
+ out.write('\n')
+ out.write('Response:\n')
+ out.write(self.response.head)
fext = 'html'
#dirs = self.response_url().split('//')[1].strip().split('/')
View
@@ -2,7 +2,7 @@
setup(
name = 'grab',
- version = '0.3.1',
+ version = '0.3.2',
description = 'Pycurl wrapper',
url = 'http://bitbucket.org/lorien/grab/',
author = 'Grigoriy Petukhov',

0 comments on commit b977511

Please sign in to comment.