a better execution harness

This commit is contained in:
pi-rho 2013-02-04 19:05:31 -06:00
parent 104b85a736
commit a7fa1c0d24
1 changed files with 11 additions and 7 deletions

View File

@ -88,10 +88,14 @@ class StinkyPinkySession(ip.HtmlSession):
# execution harness
if __name__ == '__main__':
if len(sys.argv) > 1:
s = None
reseq = ip.Dispatch(*sys.argv[1:])
for h, d in reseq:
srv, first, chunk = d
if not s:
s = StinkyPinkySession(first)
s.handle(srv, first, chunk, reseq.last)
sessions = {}
dp = ip.Dispatch(*sys.argv[1:])
for fhash, chunk in dp:
is_srv, frame, gs = chunk
if not frame:
continue
if fhash not in sessions:
sessions[fhash] = StinkyPinkySession(frame)
sessions[fhash].handle(is_srv, frame, gs, dp.last)
for sess in sessions.itervalues():
sess.done()