def save(self, path):
        """
        Save response body to file.
        """

        path_dir = os.path.split(path)[0]
        if not os.path.exists(path_dir):
            try:
                os.makedirs(path_dir)
            except OSError:
                pass

        with open(path, 'wb') as out:
            out.write(self._bytes_body if self._bytes_body is not None
                      else b'')
def save ( self , path ) : path_dir = os . path . split ( path ) [ 0 ] if not os . path . exists ( path_dir ) : try : os . makedirs ( path_dir ) except OSError : pass with open ( path , 'wb' ) as out : out . write ( self . _bytes_body if self . _bytes_body is not None else b'' )
Save response body to file.