Skip to content

Uploadto

flowtask.components.UploadTo

UploadToBase

UploadToBase(loop=None, job=None, stat=None, **kwargs)

Bases: FlowComponent

UploadToBase

Overview

The `UploadToBase` class is an abstract component designed to handle file uploads to various destinations,
including servers over HTTP/HTTPS. This class manages credentials, connection settings, SSL configurations,
and supports progress tracking during file uploads.

.. table:: Properties :widths: auto

+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| Name                    | Required | Description                                                                    |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| url                     |   Yes    | The URL to which files will be uploaded.                                        |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| credentials             |   Yes    | A dictionary containing the credentials necessary for authentication.           |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| source_file             |   No     | The path to the source file to be uploaded.                                     |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| source_dir              |   No     | The directory containing the source files to be uploaded.                       |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| filename                |   No     | The destination filename for the uploaded file.                                 |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| create_destination      |   No     | A flag indicating whether to create the destination directory if it doesn't exist.|
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| ssl                     |   No     | A flag indicating whether to use SSL/TLS for the connection.                    |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| ssl_cafile              |   No     | The path to the CA file for SSL/TLS validation.                                 |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| ssl_certs               |   No     | A list of SSL certificates to be used for the connection.                       |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| host                    |   Yes    | The host address of the destination server.                                     |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| port                    |   Yes    | The port number of the destination server.                                      |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| overwrite               |   No     | A flag indicating whether to overwrite the file if it already exists.           |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| rename                  |   No     | A flag indicating whether to rename the file if a file with the same name exists.|
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| timeout                 |   No     | The timeout value for the upload operation.                                     |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+
| response_status         |   No     | A list of acceptable HTTP response statuses for a successful upload.            |
+-------------------------+----------+-----------+----------------------------------------------------------------------------+

Return

The methods in this class manage the upload of files to specified destinations, including initialization,
execution, and result handling.

http_response async

http_response(response)

http_response.

Return the request response of the HTTP Session

Parameters:

Name Type Description Default
response Response

the Response of the HTTP Session.

required

Returns:

Name Type Description
Any

any processed data.

start async

start(**kwargs)

Start.

Processing variables and credentials.

upload_session async

upload_session(url, method='get', data=None, data_format='json')

session. connect to an http source using aiohttp