Permalink
Browse files

Added a parse_pickle script that is a proof of concept playback mecha…

…nism for the ghetto pickle.

It works, which I'm happy about, but it seems like this should be easierish.
  • Loading branch information...
1 parent 7632738 commit 49f93309f57422c93ba0d2005cdb7e30bd5fc2ee @ericholscher committed Apr 7, 2009
Showing with 25 additions and 0 deletions.
  1. +25 −0 test_utils/parse_pickle.py
View
@@ -0,0 +1,25 @@
+import re
+import cPickle as pickle
+
+f = open('/Users/ericholscher/lib/test/playground/tests/playground_testdata.pickle')
+
+buffer = []
+
+req_re = re.compile('---REQUEST_BREAK---')
+res_re = re.compile('---RESPONSE_BREAK---')
+
+for line in f.readlines():
+ if req_re.search(line):
+ to_pickle = ''.join(buffer)
+ obj = pickle.loads(to_pickle)
+ print obj['path'], obj['time']
+ buffer = []
+ elif res_re.search(line):
+ to_pickle = ''.join(buffer)
+ obj = pickle.loads(to_pickle)
+ print obj['status_code'], obj['time']
+ buffer = []
+ else:
+ buffer.append(line)
+
+

0 comments on commit 49f9330

Please sign in to comment.