def fetch_zip(uri, file=''):
    import io, urllib.request, zipfile

    yield valentina.TableHeader([
        ('name', str),
        ('data', bytes)])

    with urllib.request.urlopen(uri) as response:
        zip_data = response.read()

        with zipfile.ZipFile(io.BytesIO(zip_data)) as zip_file:
            if file:
                yield file, zip_file.open(file).read()
            else:
                for file_name in zip_file.namelist():
                    if not file_name.endswith('/'):
                        yield file_name, zip_file.open(file_name).read()

def valentina_extension_init(db):
    valentina.create_procedure('fetch_zip', fetch_zip)
