def _capture_screenshot(self, capture_url):
        print capture_url
        response = requests.get(capture_url)

        if response.status_code not in [httplib.OK, httplib.CREATED]:
            msg = 'Failed to capture screenshot: %s (%s)' % (response.text, response.status_code)
            raise Exception(msg)

        try:
            temp_file = NamedTemporaryFile(suffix='.jpg', delete=False)

            for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
                if chunk:
                    temp_file.write(chunk)
        finally:
            temp_file.close()

        return temp_file.name
dataset/ETHPy150Open StackStorm/st2contrib/packs/ipcam/actions/capture_screenshot.py/CaptureScreenshotAction._capture_screenshot/original