def upload_files_to_ftp(prefix: str, **context): downloaded = context['ti'].xcom_pull(task_ids="download_links") con_id = "ftp_data.controlciudadano.org.py" create_dir_in_ftp(con_id, os.path.dirname(prefix)) for download in downloaded: target_path = get_target_path(download, prefix) upload_to_ftp(con_id, target_path, download)
'https://www.policianacional.gov.py/nomina-de-salarios-de-personal-de-la-policia-nacional/', '.column-2 > a') to_download.extend( _get_links( 'https://www.policianacional.gov.py/convenio-y-contratos-celebrados-objeto-monto-total-de-la-contratacion-plazos-de-ejecucion-mecanismos-de-control-y-rendicion-de-cuentas/', '.entry-content a')) to_download.extend( _get_links('https://www.policianacional.gov.py/viaticos/', 'td > a')) to_download.extend( only_files( _get_links( 'https://www.policianacional.gov.py/ley-n-518914-de-libre-acceso-ciudadano-a-la-informacion-publica-y-transparencia-gubernamental-articulo-n-8/', '.column-2 > a'))) to_download.extend( only_files( _get_links( 'https://www.policianacional.gov.py/ley-n-5282-de-libre-acceso-ciudadano-a-la-informacion-publica-y-transparencia-gubernamental/', '.column-2 > a'))) to_download.extend( _get_links( 'https://www.policianacional.gov.py/informe-anual-sobre-derechos-humanos-y-situacion-carcelaria-con-especial-enfasis-en-los-derechos-sociales-a-la-salud-y-a-la-educacion/', 'td a')) return to_download if __name__ == "__main__": to_download = get_links() downloaded = download_links(to_download, "/tmp/poli") for download in downloaded: print(get_target_path(download, "2020-12-12"))