Project

General

Profile

« Previous | Next » 

Revision 1687

digir_client: Use new streams.copy() to copy returned data to stdout

View differences:

bin/digir_client
98 98
        )
99 99
    debug_log(request_xml, 'request')
100 100
    this_url = url+'?'+urllib.urlencode({'request': request_xml})
101
    diag_capture = streams.CaptureStream(streams.TimeoutInputStream(
101
    stream = streams.CaptureStream(streams.TimeoutInputStream(
102 102
        urllib2.urlopen(this_url), timeout), diags_start, diags_end)
103
    stream = streams.StreamIter(diag_capture)
104 103
    
105
    try:
106
        # Copy lines
107
        for line in stream:
108
            sys.stdout.write(line)
109
    finally: # still run if break is called
110
        stream.close()
111
        
112
        debug_log(diag_capture.match, 'diagnostics')
104
    streams.copy(stream, sys.stdout)
105
    stream.close()
106
    
107
    debug_log(stream.match, 'diagnostics')
113 108

  
114 109
main()

Also available in: Unified diff