

def execute(self, url, method=None, data=None, input_path=None, output_path=None):
    request = self.__request(url, data, method)
    input = None
    try:
        if input_path:
            size = getsize(input_path)
            if size:
                input = open(input_path, 'rb')
                data = mmap.mmap(input.fileno(), 0, access=mmap.ACCESS_READ)
            else:
                data = b''
            request.add_header('Content-Length', str(size))
        response = self._url_open(request, data)
    finally:
        if input:
            input.close()
    if output_path:
        with open(output_path, 'wb') as output:
            while True:
                buffer = response.read(1024)
                if (not buffer):
                    break
                output.write(buffer)
        return response
    else:
        return response.read()

dataset/ETHPy150Open galaxyproject/pulsar/pulsar/client/transport/standard.py Urllib2Transport.execute/original