Project

General

Profile

« Previous | Next » 

Revision 1683

digir_client: Capture diagnostics for later use in determining next start/count values

View differences:

bin/digir_client
52 52
</request>
53 53
'''
54 54

  
55
diags_start = '<diagnostics>'
56
diags_end = '</diagnostics>'
57

  
55 58
def main():
56 59
    env_names = []
57 60
    def usage_err():
......
89 92
        )
90 93
    if debug: sys.stderr.write(request_xml)
91 94
    this_url = url+'?'+urllib.urlencode({'request': request_xml})
92
    stream = streams.StreamIter(streams.TimeoutInputStream(
93
        urllib2.urlopen(this_url), timeout))
95
    diag_capture = streams.CaptureStream(streams.TimeoutInputStream(
96
        urllib2.urlopen(this_url), timeout), diags_start, diags_end)
97
    stream = streams.StreamIter(diag_capture)
94 98
    
95 99
    try:
96 100
        # Copy lines
......
98 102
            sys.stdout.write(line)
99 103
    finally: # still run if break is called
100 104
        stream.close()
105
        
106
        if debug: sys.stderr.write(diag_capture.match)
101 107

  
102 108
main()

Also available in: Unified diff