Interfaces¶
flowtask.interfaces
¶
Interfaces.
Services and methods covered by Flowtask. Support interfaces for many options on Task Components.
ClientInterface
¶
Bases: CredentialsInterface
DBInterface
¶
DBSupport
¶
Bases: CredentialsInterface
DBSupport.
Interface for adding AsyncbDB-based Database Support to Components.
FuncSupport
¶
Bases: ABC
Interface for adding Add Support for Function Replacement.
HTTPService
¶
Bases: CredentialsInterface, PandasDataframe
HTTPService.
Overview
Interface for making connections to HTTP services.
api_get
async
¶
api_get(url, cookies=None, params=None, headers=None, use_proxy=None, free_proxy=False, use_http2=True)
Make an asynchronous HTTP GET request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to send the GET request to. |
required |
cookies
|
Cookies
|
Cookies to include in the request. |
None
|
params
|
dict
|
Dictionary of query parameters to include in the URL. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The JSON response from the API if the request is successful. |
Dict[str, Any]
|
Returns an empty dictionary if the request fails. |
async_request
async
¶
Asynchronously sends an HTTP request using aiohttp.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :param use_json: Whether to send the data as JSON. :param use_proxy: force proxy usage. :return: A tuple containing the result and any error information.
build_url
¶
Constructs a full URL with optional query parameters and arguments.
:param url: The base URL to be formatted. :param queryparams: Additional query parameters to be appended to the URL. :param args: Arguments to format within the URL. :return: The fully constructed URL.
evaluate_error
async
¶
evaluate_response.
Check Response status and available payloads. Args: response (type): description url (str): description
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
description |
get_proxies
async
¶
Asynchronously retrieves a list of free proxies. TODO: SELECT or rotate the free/paid proxies.
process_request
async
¶
Processes the result of an asynchronous HTTP request.
:param future: The future object representing the asynchronous operation. :param url: The URL that was requested. :return: A tuple containing the result and any error information.
process_response
async
¶
Processes the response from an HTTP request.
:param response: The response object from aiohttp. :param url: The URL that was requested. :return: A tuple containing the processed result and any error information.
refresh_proxies
async
¶
Asynchronously refreshes the list of proxies if proxy usage is enabled.
request
async
¶
Sends an HTTP request using the requests library.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :return: A tuple containing the result and any error information.
session
async
¶
session(url, method='get', data=None, cookies=None, headers=None, use_json=False, follow_redirects=False, use_proxy=False, accept=None, return_response=False)
Asynchronously sends an HTTP request using HTTPx.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :param use_json: Whether to send the data as JSON. :param cookies: A dictionary of cookies to send with the request. :param headers: A dictionary of headers to send with the request. :return: A tuple containing the result and any error information.
LocaleSupport
¶
Bases: ABC
LocaleSupport.
Adding Support for Encoding and Locale to every Component in FlowTask.
LogSupport
¶
Bases: ABC
LogSupport.
Adding Logging support to every FlowTask Component.
MaskSupport
¶
Bases: ABC
MaskSupport.
Processing Masks Support.
mask_replacement
¶
mask_replacement.
Replacing occurrences of Masks into an String. Args: obj (Any): Any kind of object.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Object with replaced masks. |
mask_replacement_recursively
¶
This function replaces all occurrences of "{key}" in the obj structure with the corresponding value from the replacements dictionary, recursively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
an object to process. |
required |
Returns:
| Type | Description |
|---|---|
|
The modified obj structure with curly brace replacements. |
ResultSupport
¶
Bases: ABC
Support for manipulating the results of Components.
StatSupport
¶
Bases: ABC
StatSupport.
Adding Support for Task Monitor (Statistics Collector.)
TemplateSupport
¶
Bases: ABC
TemplateSupport.
Adding Support for Jinja2 Template parser on Components.
AzureClient
¶
AzureClient
¶
Bases: ClientInterface
AzureClient
Overview
The `AzureClient` class handles authentication and authorization for Azure Active Directory using the Microsoft
Authentication Library (MSAL). This class provides methods to acquire tokens for secure API requests, particularly
for the Microsoft Graph API. It supports both confidential client applications and user authentication.
.. table:: Properties :widths: auto
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| Name | Required | Description |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| tenant_id | Yes | The Azure AD tenant ID. Defaults to AZURE_ADFS_TENANT_ID from the configuration. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| client_id | Yes | The client ID of the Azure AD application. Defaults to AZURE_ADFS_CLIENT_ID from the config. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| client_secret | Yes | The client secret of the Azure AD application. Defaults to AZURE_ADFS_CLIENT_SECRET. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| scopes | No | A list of scopes for the token request. Defaults to Microsoft Graph API scopes. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| authority | Yes | The authority URL for Azure AD authentication. Defaults to Azure AD instance authority. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| credentials | Yes | A dictionary containing the credentials for Azure AD authentication. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
Return
The methods in this class handle the acquisition of access tokens and the configuration of MSAL clients for
interacting with Azure services. The tokens acquired can be used for authenticating API requests to services
like Microsoft Graph.
AzureGraph
¶
AzureGraph
¶
Bases: ClientInterface
AzureGraph
Overview
Authentication and authorization Using Azure Identity and Microsoft Graph.
find_chat_by_name
async
¶
Finds a chat by its name (topic) and returns its chat_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_name
|
str
|
The name of the chat to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: The chat_id if found, else None. |
find_one_on_one_chat
async
¶
Find the one-on-one chat between two users by their object IDs. Returns the chat_id or None if it doesn't exist.
get_channel_details
async
¶
Fetches details of a Teams channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
str
|
The ID of the team. |
required |
channel_id
|
str
|
The ID of the channel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
A dictionary containing channel details. |
get_channel_members
async
¶
Fetches the list of members in a Teams channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
str
|
The ID of the team. |
required |
channel_id
|
str
|
The ID of the channel. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List[Dict]: A list of member objects. |
get_chat_messages
async
¶
Get chat messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
str
|
Id of Chat |
required |
Returns:
| Type | Description |
|---|---|
Optional[List]
|
Optional[List]: All Chat Messages based on criteria. |
get_msteams_channel_messages
async
¶
get_msteams_channel_messages(team_id, channel_id, start_time=None, end_time=None, max_messages=None)
Fetches messages from a Teams channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
str
|
The ID of the team. |
required |
channel_id
|
str
|
The ID of the channel. |
required |
start_time
|
str
|
ISO 8601 formatted start time to filter messages. |
None
|
end_time
|
str
|
ISO 8601 formatted end time to filter messages. |
None
|
max_messages
|
int
|
Maximum number of messages to retrieve. |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List[Dict]: A list of message objects. |
get_token
async
¶
Retrieves an access token for Microsoft Graph API using ClientSecretCredential.
get_user
async
¶
Fetches user information from Microsoft Graph API based on user ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The Azure AD object ID of the user. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
User information as a dictionary. |
get_user_info
async
¶
Fetches user information from Microsoft Graph API basado en el userPrincipalName o ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_principal_name
|
str
|
the UPN (email) or the objectId of the user. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Información del usuario. |
list_chats
async
¶
Lists all chats accessible to the application or user.
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List[Dict]: A list of chat objects. |
open
¶
Initializes the Microsoft Graph client using: - MSAL + StaticTokenCredential if user+password is provided (delegated flow). - ClientSecretCredential for app-only in other cases.
user_chat_messages
async
¶
user_chat_messages(user, chat_id, start_time=None, end_time=None, messages_per_page=50, max_messages=None, max_retries=3)
Get User chat messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
str
|
Id of Chat |
required |
Returns:
| Type | Description |
|---|---|
Optional[List]
|
Optional[List]: All Chat Messages based on criteria. |
Boto3Client
¶
Boto3Client
¶
Bases: ClientInterface
Boto3 AWS Client.
Overview
Abstract class for interaction with Boto3 (AWS).
.. table:: Properties
:widths: auto
+------------------------+----------+-----------+-------------------------------------------------------+ | Name | Required | Summary | +------------------------+----------+-----------+-------------------------------------------------------+ |credentials | Yes | The function is loaded and then we define the necessary code to | | | | call the script | +------------------------+----------+-----------+-------------------------------------------------------+ | _init | Yes | Component for Data Integrator | +------------------------+----------+-----------+-------------------------------------------------------+ | _host | Yes | The IPv4 or domain name of the server | +------------------------+----------+-----------+-------------------------------------------------------+ | get_client | Yes | Gets the client access credentials, by which the user logs in to | | | | perform an action | +------------------------+----------+-----------+-------------------------------------------------------+ | print | Yes | Print message to display | +------------------------+----------+-----------+-------------------------------------------------------+ | get_env_value | Yes | Get env value policies for setting virtual environment | +------------------------+----------+-----------+-------------------------------------------------------+ | processing_credentials | Yes | client credentials configured for used of the app | +------------------------+----------+-----------+-------------------------------------------------------+
Return the list of arbitrary days
get_s3_object
async
¶
Retrieve an object from an S3 bucket.
Parameters¶
bucket: str The name of the S3 bucket. filename: str The name of the file (key) in the S3 bucket.
Returns¶
dict A dictionary containing the object data and metadata.
Raises¶
FileNotFound If the object is not found in the bucket. ComponentError If there is an issue with retrieving the object.
DropboxClient
¶
DropboxClient
¶
Bases: ABC
Dropbox Client for downloading and uploading files and folders to/from Dropbox.
ExcelHandler
¶
ExcelHandler
¶
append_data_to_excel
¶
Append data from a DataFrame to an existing Excel file.
:param df: DataFrame containing data to append. :param file_path: Path to the Excel file. :param sheet_name: Name of the sheet to append data to. :param start_row: Starting row to append data (default is after last row). :param start_col: Starting column to append data. :param include_header: Whether to include the DataFrame's header.
create_excel_from_template
¶
Create a new Excel file from a template.
:param template_path: Path to the Excel template. :param new_file_path: Path where the new Excel file will be saved.
create_new_excel_file
¶
Create a new Excel file.
:param file_path: Path where the new Excel file will be saved.
edit_excel
¶
Edit an existing Excel file using a provided function.
:param file_path: Path to the Excel file. :param edit_func: Function that takes a Workbook object and edits it.
pandas_to_excel
¶
Save a pandas DataFrame to an Excel file.
:param df: DataFrame to save. :param file_path: Path to save the Excel file. :param kwargs: Additional keyword arguments for pandas' to_excel method.
FTPClient
¶
FTP Client.
Overview
This class provides functionalities for asynchronous operations with an FTP server, including establishing connections, checking directory existence, changing working directories, and downloading files.
FTPClient
¶
Bases: ClientInterface
download_file
async
¶
download_file
Download a File from FTP based on Path. Args: file (str): file to be downloaded destination (str): path to destination rewrite (bool): file if exists, will be overwrite TODO: Support for write_into and Renaming Files.
GoogleCalendar
¶
GoogleCalendarClient
¶
Bases: GoogleClient, ABC
Google Calendar Client for managing calendar events.
check_event_start_time
async
¶
Check if the current time has reached or passed the event's start time and trigger an action if so.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_start_time
|
datetime
|
The start time of the event to check. |
required |
create_event
async
¶
Create an event in the specified Google Calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar to add the event to. |
required |
event
|
dict
|
The event details. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the created event. |
create_subscription
async
¶
Create a subscription to receive notifications when events are created, updated, or deleted in the calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_url
|
str
|
The webhook URL that will receive the notifications. |
required |
client_state
|
str
|
A client secret string for verifying notifications. |
'secret_string'
|
expiration_hours
|
int
|
Duration for which the subscription should be valid (maximum is 4230 minutes or 7 days). |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The response from Microsoft Graph API with subscription details. |
delete_event
async
¶
Delete an event from the specified calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event_id
|
str
|
The ID of the event to delete. |
required |
get_event
async
¶
Retrieve details of a specific event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event_id
|
str
|
The ID of the event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the event. |
list_events
async
¶
List events in a specified time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar to list events from. |
required |
time_min
|
datetime
|
Start time to retrieve events. |
required |
time_max
|
datetime
|
End time to retrieve events. |
required |
max_results
|
int
|
Maximum number of events to retrieve (default is 10). |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
List[Dict]
|
List of events within the time range. |
setup_watch
async
¶
Sets up a watch on the specified calendar to receive notifications when events are created, updated, or deleted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar to monitor. |
required |
webhook_url
|
str
|
The URL of the webhook endpoint to receive notifications. |
required |
channel_id
|
str
|
Unique ID for this notification channel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
The response from the Google Calendar API containing the channel information. |
update_event
async
¶
Update an existing event in the calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar containing the event. |
required |
event_id
|
str
|
The ID of the event to update. |
required |
updated_event
|
dict
|
The updated event details. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the updated event. |
GoogleClient
¶
GoogleClient
¶
Bases: ABC
Google Client Client.
Managing Authentication and resources from Google Apps.
get_search
¶
Get a cached Google API service instance or create one if not cached.
Args:
query (str): The search query.
version (str): Version of the API (default: 'v1').
cse_id (str): The Custom Search Engine ID.
**kwargs: Additional arguments for the API request.
Returns:
| Type | Description |
|---|---|
|
googleapiclient.discovery.Resource: The requested Google API service client. |
get_service
¶
Get a cached Google API service instance or create one if not cached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
str
|
Name of the Google service (e.g., 'drive', 'sheets'). |
required |
version
|
str
|
Version of the API (default: 'v3'). |
'v3'
|
Returns:
| Type | Description |
|---|---|
|
googleapiclient.discovery.Resource: The requested Google API service client. |
GoogleDrive
¶
GoogleDriveClient
¶
Bases: GoogleClient, ABC
Google Drive Client for downloading files from Google Drive.
download_file
async
¶
Download a file from Google Drive by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_filename
|
str
|
The name of the file to download. |
required |
destination_dir
|
str or Path
|
Directory where the file will be saved (default is current directory). |
'.'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
PurePath
|
Path to the downloaded file. |
download_folder
async
¶
Download all files within a specified Google Drive folder by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_name
|
str
|
The name of the folder to download. |
required |
destination_dir
|
str or Path
|
Directory where the files will be saved. |
'.'
|
Returns:
| Type | Description |
|---|---|
None
|
None |
GoogleGCS
¶
GoogleCloudStorageClient
¶
Bases: GoogleClient, ABC
Google Cloud Storage Client for interacting with Google Cloud Storage (GCS). Provides methods for file and folder operations.
GoogleGeocoding
¶
GoogleMapsGeocodingClient
¶
Bases: GoogleClient, ABC
Google Maps Geocoding Client for location-based tasks including geocoding, reverse geocoding, distance calculation, and place details.
calculate_distance
async
¶
Calculate the distance between two locations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
str
|
Starting location (address or coordinates). |
required |
destination
|
str
|
Ending location (address or coordinates). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Distance and duration between the origin and destination. |
geocode_address
async
¶
Geocode an address to retrieve latitude and longitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The address to geocode. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Geocoded location with latitude and longitude. |
get_place_details
async
¶
Get detailed information about a place by its place ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
place_id
|
str
|
The place ID of the location. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Detailed information about the place. |
reverse_geocode
async
¶
Reverse geocode coordinates to retrieve address information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
float
|
Latitude of the location. |
required |
lng
|
float
|
Longitude of the location. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
List[Dict]
|
List of addresses for the location. |
GoogleLang
¶
GoogleLanguage
¶
Bases: GoogleClient, ABC
Google Cloud Natural Language Client for analyzing text for sentiment, entities, syntax, and content classification.
analyze_entities
async
¶
Analyze entities in the provided text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to analyze. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of entities with their types and salience scores. |
analyze_sentiment
async
¶
Analyze the sentiment of the provided text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to analyze. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Sentiment score and magnitude. |
analyze_syntax
async
¶
Analyze syntax of the provided text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to analyze. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of tokens with their parts of speech and dependency relationships. |
classify_text
async
¶
Classify the content of the provided text into categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to classify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of categories with confidence scores. |
GoogleSheet
¶
GoogleSheetsClient
¶
Bases: GoogleClient, ABC
Google Sheets Client for downloading and interacting with Google Sheets.
download_file
async
¶
Download the content of a Google Sheet in various formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet_id
|
str
|
The ID of the Google Sheet. |
required |
worksheet_name
|
str
|
The name of the worksheet (optional, defaults to the first sheet). |
None
|
file_type
|
str
|
Desired format - 'dataframe', 'json', 'excel', or 'csv'. |
'dataframe'
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, str]
|
pd.DataFrame or str: DataFrame if requested, or the file path for other formats. |
IMAPClient
¶
IMAP/POP Client.
Class for operations with IMAP Mailboxes.
IMAPClient
¶
Bases: ClientInterface
IMAPClient
Overview
The IMAPClient class provides operations for interacting with IMAP mailboxes.
It supports both SSL and non-SSL
connections and uses XOAUTH2 authentication by default.
.. table:: Properties :widths: auto
+------------------+----------+------------------------------------------------------------------------------------------+
| Name | Required | Description |
+------------------+----------+------------------------------------------------------------------------------------------+
| use_ssl | No | Boolean flag to specify whether to use SSL, defaults to True. |
+------------------+----------+------------------------------------------------------------------------------------------+
| mailbox | No | The mailbox to access, defaults to "Inbox". |
+------------------+----------+------------------------------------------------------------------------------------------+
| overwrite | No | Boolean flag to specify whether to overwrite existing configurations, defaults to False. |
+------------------+----------+------------------------------------------------------------------------------------------+
Return
The methods in this class manage the connection to the IMAP server and perform authentication and closure of
the connection.
O365Calendar
¶
OutlookCalendarClient
¶
Bases: O365Client
Outlook Calendar Client for managing calendar events through Microsoft Graph API.
create_event
async
¶
Create an event in the specified Outlook calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event
|
dict
|
The event details. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the created event. |
delete_event
async
¶
Delete an event from the specified calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event_id
|
str
|
The ID of the event to delete. |
required |
get_event
async
¶
Retrieve details of a specific event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event_id
|
str
|
The ID of the event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the retrieved event. |
list_events
async
¶
List events in a specified time range in the specified calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
start_datetime
|
datetime
|
Start time for retrieving events. |
required |
end_datetime
|
datetime
|
End time for retrieving events. |
required |
max_results
|
int
|
Maximum number of events to retrieve (default: 10). |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
List[Dict]
|
List of events in the specified time range. |
update_event
async
¶
Update an existing event in the specified calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar_id
|
str
|
The ID of the calendar. |
required |
event_id
|
str
|
The ID of the event. |
required |
updated_event
|
dict
|
Updated event details. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Details of the updated event. |
O365Client
¶
O365Client
¶
Bases: CredentialsInterface
O365Client
Overview
The O365Client class is an abstract base class for managing connections to Office 365 services.
It handles authentication, credential processing, and provides a method for obtaining the
Office 365 context. It uses the Office 365 Python SDK for authentication and context management.
.. table:: Properties :widths: auto
+------------------+----------+--------------------------------------------------------------------------------------------------+
| Name | Required | Description |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| url | No | The base URL for the Office 365 service. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| tenant | Yes | The tenant ID for the Office 365 service. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| site | No | The site URL for the Office 365 service. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| auth_context | Yes | The authentication context for Office 365. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| context | Yes | The context object for Office 365 operations. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| credentials | Yes | A dictionary containing the credentials for authentication. |
+------------------+----------+--------------------------------------------------------------------------------------------------+
Return
The methods in this class manage the authentication and connection setup for Office 365 services,
providing an abstract base for subclasses to implement specific service interactions.
OneDrive
¶
OneDriveClient
¶
Bases: O365Client
OneDrive Client.
Interface for Managing connections to OneDrive resources.
Methods:
| Name | Description |
|---|---|
file_list |
Lists files in a specified OneDrive folder. |
file_search |
Searches for files matching a query. |
file_download |
Downloads a single file by its item ID. |
download_files |
Downloads multiple files provided as a list of dictionaries containing file info. |
folder_download |
Downloads a folder and its contents recursively. |
file_delete |
Deletes a file or folder by its item ID. |
upload_files |
Uploads multiple files to a specified OneDrive folder. |
upload_file |
Uploads a single file to OneDrive. |
upload_folder |
Uploads a local folder and its contents to OneDrive recursively. |
download_excel_file
async
¶
Download an Excel file from OneDrive by item ID.
If as_pandas is True, return as a pandas DataFrame.
If as_pandas is False, save to the destination path.
download_files
async
¶
Download multiple files from OneDrive.
file_search
async
¶
Search for files in OneDrive matching the search query.
folder_download
async
¶
Download a folder and its contents from OneDrive.
upload_dataframe_as_excel
async
¶
Upload a pandas DataFrame as an Excel file to OneDrive.
upload_file
async
¶
Upload a single file to OneDrive.
upload_files
async
¶
Upload multiple files to OneDrive.
upload_folder
async
¶
Upload a local folder and its contents to OneDrive.
Outlook
¶
OutlookClient
¶
Bases: O365Client
Outlook Client.
Managing connections to Outlook Mail API.
list_messages
async
¶
List messages in a specified folder.
move_message
async
¶
Move a message to a different folder.
search_messages
async
¶
Search for messages matching the search query.
send_message
async
¶
send_message(subject, body, to_recipients, cc_recipients=None, bcc_recipients=None, attachments=None, from_address=None)
Send a message with optional attachments and optional 'on behalf of' another user.
ParrotBot
¶
ParrotBot
¶
ParrotBot.
Interface for creating new chatbots to be used directly as Flowtask Components
bot_evaluation
async
¶
bot_evaluation
Overview
The run method is a method for running the ParrotBot component.
Return
A Pandas Dataframe with the IA-based statistics.
start
async
¶
start
Overview
The start method is a method for starting the CustomerSatisfaction component.
Parameters
kwargs: dict
A dictionary containing the parameters for the CustomerSatisfaction component.
Return
True if the CustomerSatisfaction component started successfully.
SOAPClient
¶
NoProxyAsyncTransport
¶
Bases: AsyncTransport
Zeep AsyncTransport subclass that: - Omits 'proxies=' when building the sync httpx.Client (avoids httpx>=0.28 errors). - Provides the attributes Zeep expects (client, logger, _close_session). - Disables automatic session close in destructor to avoid AsyncClient.close errors.
SOAPClient
¶
SOAPClient(*, credentials, httpx_client=None, redis_url='redis://localhost:6379/0', redis_key='soap:access_token', timeout=30, **kwargs)
Bases: ABC
SOAPClient
Overview
The SOAPClient class is a generic asynchronous base for SOAP integrations.
It provides OAuth2 refresh_token grant, Redis caching of access_token, and
customizable httpx.AsyncClient for Zeep. Designed for easy extension to
specific SOAP APIs.
.. table:: Properties
:widths: auto
+-------------------+----------+-----------+---------------------------------------------------------------+
| Name | Required | Summary |
+-------------------+----------+-----------+---------------------------------------------------------------+
| credentials | Yes | Dict with client_id, client_secret, token_url, wsdl_path, refresh_token |
| httpx_client | No | Optionally inject a configured AsyncClient |
| redis_url | No | Redis DSN for token cache |
| redis_key | No | Key under which to cache the access token |
| timeout | No | HTTP request timeout (seconds) |
+-------------------+----------+-----------+---------------------------------------------------------------+
Returns
This component provides an async interface to SOAP APIs, handling authentication,
caching, and Zeep client/service setup. Subclasses should implement specific
SOAP operations.
Example:
```python
class MyClient(SOAPClient):
...
```
"client_secret": str,
"token_url": str,
"wsdl_path": Union[str, Path],
"refresh_token": str
} :param httpx_client: optionally inject a configured AsyncClient :param redis_url: Redis DSN for token cache :param redis_key: key under which to cache the access token :param timeout: HTTP request timeout (seconds)
start
async
¶
1) Connect to Redis 2) Get or refresh the bearer token 3) Build Zeep transport, client, and bind the service
SSHClient
¶
SSHClient
¶
Bases: ClientInterface
SSHClient
Overview
The SSHClient class is a component for managing SSH and SFTP connections. It provides methods for establishing connections,
running commands, downloading, uploading, and copying files using SFTP. It supports various SSH algorithms and handles
errors gracefully.
.. table:: Properties :widths: auto
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| Name | Required | Description |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| block_size | No | The block size for file transfers, defaults to 16384 bytes. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| max_requests | No | The maximum number of concurrent requests, defaults to 128. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| algorithms | No | A list of supported SSH algorithms. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| commands | No | A list of commands to run over SSH. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| only_sftp | No | A flag indicating if only SFTP connections are allowed. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| tunnel | Yes | Describes an SSH tunnel connection |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| _connection | Yes | The current SSH connection object. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| _clientargs | Yes | Arguments for the SSH client configuration. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| client_keys | Yes | SSH public key |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| source | Yes | List of algorithms to be used in connection encryption |
+------------------+----------+--------------------------------------------------------------------------------------------------+
Return
The methods in this class facilitate SSH and SFTP operations, including establishing connections,
file transfers, command execution, and handling SSH tunnels. The class also manages environment settings
and provides error handling mechanisms specific to SSH and SFTP operations.
copy_files
async
¶
copy_files.
Use can copy/move one or more files (or directories) in server. Args: file (Union[str,List[PurePath]]): Path (purepath) or list of paths for files or directories destination (Purepath or str): remote destination of upload preserve (bool, optional): preserve the original attributes. Defaults False. recurse (bool, optional): copy recursively all directories. Defaults False. Returns: bool: file(s) or directorires were uploaded or not.
download_files
async
¶
download_file
Download a File from sFTP based on Path. Args: path (str): file to be downloaded TODO: Support for write_into and Renaming Files.
upload_files
async
¶
upload_files.
Use can upload one or more files (or directories) recursively. Args: file (Union[str,List[PurePath]]): Path (purepath) or list of paths for files or directories destination (Purepath or str): remote destination of upload preserve (bool, optional): preserve the original attributes. Defaults False. recurse (bool, optional): copy recursively all directories. Defaults False. Returns: bool: file(s) or directorires were uploaded or not.
Sharepoint
¶
SharepointClient
¶
Bases: O365Client
Sharepoint Client.
Managing connections to MS Sharepoint Resources.
create_subscription
async
¶
Create a webhook subscription to receive notifications when files are added, updated, or deleted in a SharePoint document library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
library_id
|
str
|
The ID of the SharePoint document library to subscribe to. |
required |
webhook_url
|
str
|
The webhook URL to receive notifications. |
required |
client_state
|
str
|
A secret string to verify notifications. |
'secret_string'
|
expiration_days
|
int
|
Duration in days for the subscription to be valid (maximum is 180 days). |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The response from Microsoft Graph API containing the subscription details. |
download_files
async
¶
Download a list of files from SharePoint to a specified destination directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[dict]
|
A list of dictionaries with 'directory' and 'filename' keys. |
required |
destination_dir
|
str
|
The local directory where files will be downloaded. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
List |
List
|
A list of paths to the downloaded files. |
get_library_id
¶
Extracts the Library ID of a SharePoint document library from an absolute URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
absolute_url
|
str
|
The absolute URL of the SharePoint resource. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the document library. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the library ID could not be retrieved. |
upload_files
async
¶
Upload files to a SharePoint folder using a resumable upload for large files.
cache
¶
CacheSupport
¶
Bases: ABC
Very Basic Cache Support using Redis
parse_duration
¶
Parse a duration string and return its value in seconds.
Supported formats: - "Xs" for seconds - "Xm" for minutes - "Xh" for hours
setex
async
¶
setex Set the value and expiration of a Key params: key: key Name value: value of the key timeout: expiration time in seconds
setexp
¶
setexp Set the value and expiration of a Key params: key: key Name value: value of the key timeout: expiration time in seconds
client
¶
ClientInterface
¶
Bases: CredentialsInterface
compress
¶
CompressSupport
¶
Bases: ABC
CompressSupport.
Overview
This component handles compressing and uncompressing files and folders into various formats. Supported formats: - ZIP (.zip and .jar) - TAR (.tar) - GZ (.gz) - BZIP2 (.bz2) - XZ (.xz) - 7z (.7z) - RAR (.rar)
Methods:
| Name | Description |
|---|---|
- compress |
Compress files/folders into various formats. |
- uncompress |
Uncompress files/folders from various formats. |
- zip_file |
Compress a single file into a zip file. |
- unzip_file |
Uncompress a single file from a zip archive. |
- zip_folder |
Compress a folder into a zip file. |
- unzip_folder |
Uncompress files from a zip archive to a folder. |
Parameters: - source: Path to the file or folder to be compressed or uncompressed. - destination: Path where the compressed/uncompressed file should be saved. - remove_source: Boolean to remove the source file/folder after operation.
compress
async
¶
Compress the given source into the destination file in the specified format.
compress_7z
async
¶
Compress files/folders into a 7z archive.
compress_gzip
async
¶
Compress a file or folder into a gzip file. If the extension indicates a tarball format (e.g., .tar.gz, .tar.bz2, .tar.xz), compress as a tarball; otherwise, compress as a simple .gz file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Union[str, PosixPath]
|
The file or folder to compress. |
required |
destination
|
Union[str, PosixPath]
|
The destination path for the compressed file. |
required |
extension
|
str
|
The desired extension (e.g., .gz, .tar.gz, .tar.bz2, .tar.xz). |
'.gz'
|
remove_source
|
bool
|
Whether to remove the source file/folder after compression. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The path of the compressed file. |
compress_rar
async
¶
Compress files/folders into a rar archive.
compress_tar
async
¶
Compress files/folders into a tar archive.
compress_zip
async
¶
compress_zip(source, destination, compress_type=ZIP_DEFLATED, compress_level=9, remove_source=False)
Compress files/folders into a zip archive.
uncompress
async
¶
Uncompress the given source file into the destination folder.
uncompress_7z
async
¶
Uncompress files from a 7z archive.
uncompress_gzip
async
¶
Uncompress a Gzip file or tarball and return the list of uncompressed files.
uncompress_rar
async
¶
Uncompress files from a rar archive.
uncompress_tar
async
¶
Uncompress files from a tar archive.
uncompress_zip
async
¶
Uncompress files from a zip archive.
unzip_folder
async
¶
Uncompress files from a zip archive into a folder.
zip_file
async
¶
Compress a single file into a zip file.
zip_folder
async
¶
Compress a folder into a zip file.
credentials
¶
CredentialsInterface
¶
Bases: ABC
get_env_value
¶
Retrieves a value from the environment variables or the configuration.
:param key: The key for the environment variable. :param default: The default value to return if the key is not found. :return: The value of the environment variable or the default value.
d2l
¶
D2L.
Making operations over D2L.
databases
¶
DBSupport
¶
Bases: CredentialsInterface
DBSupport.
Interface for adding AsyncbDB-based Database Support to Components.
db
¶
DBSupport
¶
Bases: CredentialsInterface
DBSupport.
Interface for adding AsyncbDB-based Database Support to Components.
documentdb
¶
dataframes
¶
ArrowDataframe
¶
Bases: BaseDataframe
ArrowDataframe.
Converts any result into a Arrow DataFrame.
create_dataframe
async
¶
Converts any result into a Arrow DataFrame.
:param result: The result data to be converted into a Arrow DataFrame. :return: A DataFrame containing the result data.
DtDataframe
¶
Bases: BaseDataframe
DtDataframe.
Converts any result into a Datatable DataFrame.
create_dataframe
async
¶
Converts any result into a Datatable DataFrame.
:param result: The result data to be converted into a Datatable DataFrame. :return: A DataFrame containing the result data.
PandasDataframe
¶
Bases: BaseDataframe
PandasDataframe.
Converts any result into a Pandas DataFrame.
create_dataframe
async
¶
Converts any result into a Pandas DataFrame.
:param result: The result data to be converted into a Pandas DataFrame. :return: A DataFrame containing the result data.
from_csv
async
¶
Converts a Comma-Separated CSV into a Pandas DataFrame.
:param result: The result data to be converted into a Pandas DataFrame. :return: A DataFrame containing the result data.
PolarsDataframe
¶
Bases: BaseDataframe
PolarsDataframe.
Converts any result into a Polars DataFrame.
create_dataframe
async
¶
Converts any result into a Polars DataFrame.
:param result: The result data to be converted into a Polars DataFrame. :return: A DataFrame containing the result data.
abstract
¶
arrow
¶
ArrowDataframe
¶
Bases: BaseDataframe
ArrowDataframe.
Converts any result into a Arrow DataFrame.
create_dataframe
async
¶
Converts any result into a Arrow DataFrame.
:param result: The result data to be converted into a Arrow DataFrame. :return: A DataFrame containing the result data.
is_empty
¶
check_empty. Check if a basic object, a Apache Arrow Table is empty or not.
dt
¶
DtDataframe
¶
Bases: BaseDataframe
DtDataframe.
Converts any result into a Datatable DataFrame.
create_dataframe
async
¶
Converts any result into a Datatable DataFrame.
:param result: The result data to be converted into a Datatable DataFrame. :return: A DataFrame containing the result data.
is_empty
¶
check_empty. Check if a basic object, a Polars DataFrame, an Apache Arrow Table, or a Python DataTable Frame is empty or not.
pandas
¶
PandasDataframe
¶
Bases: BaseDataframe
PandasDataframe.
Converts any result into a Pandas DataFrame.
create_dataframe
async
¶
Converts any result into a Pandas DataFrame.
:param result: The result data to be converted into a Pandas DataFrame. :return: A DataFrame containing the result data.
from_csv
async
¶
Converts a Comma-Separated CSV into a Pandas DataFrame.
:param result: The result data to be converted into a Pandas DataFrame. :return: A DataFrame containing the result data.
polars
¶
PolarsDataframe
¶
Bases: BaseDataframe
PolarsDataframe.
Converts any result into a Polars DataFrame.
create_dataframe
async
¶
Converts any result into a Polars DataFrame.
:param result: The result data to be converted into a Polars DataFrame. :return: A DataFrame containing the result data.
is_empty
¶
check_empty. Check if a basic object or a DataFrame (Pandas or Polars) is empty or not.
env
¶
EnvSupport
¶
Bases: ABC
EnvSupport.
Support for Environment Variables
get_env_value
¶
Retrieves a value from the environment variables or the configuration.
:param key: The key for the environment variable. :param default: The default value to return if the key is not found. :param expected_type: the data type to be expected. :return: The value of the environment variable or the default value.
http
¶
HTTPService
¶
Bases: CredentialsInterface, PandasDataframe
HTTPService.
Overview
Interface for making connections to HTTP services.
api_get
async
¶
api_get(url, cookies=None, params=None, headers=None, use_proxy=None, free_proxy=False, use_http2=True)
Make an asynchronous HTTP GET request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to send the GET request to. |
required |
cookies
|
Cookies
|
Cookies to include in the request. |
None
|
params
|
dict
|
Dictionary of query parameters to include in the URL. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The JSON response from the API if the request is successful. |
Dict[str, Any]
|
Returns an empty dictionary if the request fails. |
async_request
async
¶
Asynchronously sends an HTTP request using aiohttp.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :param use_json: Whether to send the data as JSON. :param use_proxy: force proxy usage. :return: A tuple containing the result and any error information.
build_url
¶
Constructs a full URL with optional query parameters and arguments.
:param url: The base URL to be formatted. :param queryparams: Additional query parameters to be appended to the URL. :param args: Arguments to format within the URL. :return: The fully constructed URL.
evaluate_error
async
¶
evaluate_response.
Check Response status and available payloads. Args: response (type): description url (str): description
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
description |
get_proxies
async
¶
Asynchronously retrieves a list of free proxies. TODO: SELECT or rotate the free/paid proxies.
process_request
async
¶
Processes the result of an asynchronous HTTP request.
:param future: The future object representing the asynchronous operation. :param url: The URL that was requested. :return: A tuple containing the result and any error information.
process_response
async
¶
Processes the response from an HTTP request.
:param response: The response object from aiohttp. :param url: The URL that was requested. :return: A tuple containing the processed result and any error information.
refresh_proxies
async
¶
Asynchronously refreshes the list of proxies if proxy usage is enabled.
request
async
¶
Sends an HTTP request using the requests library.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :return: A tuple containing the result and any error information.
session
async
¶
session(url, method='get', data=None, cookies=None, headers=None, use_json=False, follow_redirects=False, use_proxy=False, accept=None, return_response=False)
Asynchronously sends an HTTP request using HTTPx.
:param url: The URL to send the request to. :param method: The HTTP method to use (e.g., 'GET', 'POST'). :param data: The data to send in the request body. :param use_json: Whether to send the data as JSON. :param cookies: A dictionary of cookies to send with the request. :param headers: A dictionary of headers to send with the request. :return: A tuple containing the result and any error information.
bad_gateway_exception
¶
Check if the exception is a 502 Bad Gateway error.
locale
¶
LocaleSupport
¶
Bases: ABC
LocaleSupport.
Adding Support for Encoding and Locale to every Component in FlowTask.
mask
¶
MaskSupport
¶
Bases: ABC
MaskSupport.
Processing Masks Support.
mask_replacement
¶
mask_replacement.
Replacing occurrences of Masks into an String. Args: obj (Any): Any kind of object.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Object with replaced masks. |
mask_replacement_recursively
¶
This function replaces all occurrences of "{key}" in the obj structure with the corresponding value from the replacements dictionary, recursively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
an object to process. |
required |
Returns:
| Type | Description |
|---|---|
|
The modified obj structure with curly brace replacements. |
notification
¶
Interface for sending messages using Notify.
parrot
¶
Parrot-ai Interfaces for creating Chatbots and IA-Agents integrated with FlowTask.
agent
¶
Create a Parrot AI Agent for FlowTask.
AgentBase
¶
Bases: ABC
AgentBase.
Interface for creating new Parrot AI Agents to be used directly as Flowtask Components.
tools
¶
models
¶
EmployeeInput
¶
Bases: BaseModel
Input schema for employee-related operations requiring an Employee ID.
ManagerInput
¶
Bases: BaseModel
Input schema for manager-related operations requiring a Manager ID.
NextStopStore
¶
Bases: Model
Model representing Table for the NextStop system.
Meta
¶Meta class for NextStopStore model.
StoreInfoInput
¶
Bases: BaseModel
Input schema for store-related operations requiring a Store ID.
store
¶
StoreInfo
¶
Bases: BaseToolkit
Comprehensive toolkit for store information and demographic analysis.
This toolkit provides tools to: 1. Get detailed visit information for specific stores including recent visit history 2. Retrieve comprehensive store information including location and visit statistics 3. Foot traffic analysis for stores, providing insights into customer behavior
All tools are designed to work asynchronously with database connections and external APIs.
Tools included: - get_visit_info: Retrieves the last visits for a specific store - get_foot_traffic: Fetches foot traffic data for a store - get_store_information: Gets complete store details and aggregate visit metrics - get_employee_sales: Fetches Employee Sales data and ranked performance.
get_by_employee_visits
async
¶Get visits information for a specific employee.
This coroutine retrieves the most recent visits made by the specified employee, including detailed visit metrics and questions answered during those visits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
employee_id
|
str
|
The unique identifier of the employee. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Data containing the last visits with detailed information. |
get_dataset
async
¶Fetch a dataset based on the provided query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The query string to fetch the dataset. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the dataset. |
get_employee_sales
async
¶Get foot traffic data for a specific store. This coroutine retrieves the foot traffic data for the specified store, including the number of visitors and average visits per day.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manager
|
str
|
The unique identifier of the Manager (Associate OID). |
required |
Returns: str: Data containing employee sales data and rankings.
get_employee_visits
async
¶Get Employee Visits data for a specific Manager. This coroutine retrieves the visit data for employees under a specific manager, including the number of visits, average visit duration, and most frequent visit hours. Args: manager (str): The unique identifier of the Manager (Associate OID). Returns: str: Data containing employee sales data and rankings.
get_foot_traffic
async
¶Get foot traffic data for a specific store. This coroutine retrieves the foot traffic data for the specified store, including the number of visitors and average visits per day.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_id
|
str
|
The unique identifier of the store. |
required |
Returns: str: JSON string containing foot traffic data for the store.
get_store_information
async
¶Get comprehensive store information for a specific store.
This coroutine retrieves complete store details including location, contact information, operating schedule, and aggregate visit metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_id
|
str
|
The unique identifier of the store. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
JSON string containing comprehensive store information and visit statistics. |
get_tools
¶Get all available tools in the toolkit.
Returns:
| Type | Description |
|---|---|
List[BaseTool]
|
List[BaseTool]: A list of configured Langchain tools ready for agent use. |
get_visit_info
async
¶Get visit information for a specific store.
This coroutine retrieves the most recent visits for the specified store, including detailed visit metrics and questions answered during those visits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_id
|
str
|
The unique identifier of the store. |
required |
Returns:
| Type | Description |
|---|---|
List[dict]
|
List[dict]: Data containing the last visits with detailed information. |
playwright
¶
PlaywrightService
¶
Bases: ABC
PlaywrightService
An interface for making HTTP connections using Playwright, analogous to your SeleniumService.
check_by_attribute
¶
Convert a tuple (attribute, value) into a Playwright selector. For example, ('id', 'submit') becomes '#submit' and ('xpath', '//button') becomes 'xpath=//button'.
get_driver
async
¶
Initialize Playwright, launch a browser (with proxy and/or mobile emulation if configured), and return a new Page instance.
get_etree
async
¶
Return a tuple of lxml etree objects (using etree.fromstring and html.fromstring) for the current page content.
get_page
async
¶
Navigate to a given URL, optionally set cookies, wait for page load, and optionally handle any cookie-acceptance banners.
get_soup
async
¶
Return a BeautifulSoup object for the current page content.
proxy_playwright
¶
Return a proxy configuration dictionary for Playwright.
save_screenshot
async
¶
Save a screenshot of the entire page or of a specific element if configured.
search_google_cse
async
¶
Perform a Google Custom Search Engine (CSE) search using Playwright. Returns a list of results where each result is a dict with 'title' and 'link'.
powerpoint
¶
PowerPointClient
¶
Bases: ABC
append_slides_to_presentation
staticmethod
¶
Edit a PowerPoint file to append more slides from an iterator.
:param file_path: Path to the existing PowerPoint file. :param slide_contents: An iterator where each item is a dict with content for a slide.
create_empty_presentation
staticmethod
¶
Create an empty PowerPoint presentation.
:param file_path: Path where the new PowerPoint file will be saved.
create_presentation_from_template
¶
create_presentation_from_template(template_path, slide_contents, file_path, default_master_index=0, default_layout_index=1)
Create a presentation from a template, adding texts or images per slide.
:param template_path: Path to the PowerPoint template file. :param slide_contents: An iterator where each item is a dict with content for a slide. :param file_path: Path where the new PowerPoint file will be saved. :param default_layout_index: Default slide layout index to use if not specified per slide.
create_presentation_from_text_list
staticmethod
¶
Create a PowerPoint file where each slide contains text from a list.
:param text_list: List of texts to add to slides. :param file_path: Path where the new PowerPoint file will be saved.
create_slide
staticmethod
¶
create_slide(text_content=None, image_path=None, image_size=None, font_size=18, font_color='000000', font_name='Calibri', layout_index=None)
Create a slide content dictionary.
:param text_content: Text to include in the slide. :param image_path: Path to the image file to include in the slide. :param image_size: Tuple of three elements (left, top, width) for image positioning. :param font_size: Font size for the text. :param font_color: Font color for the text in hex format (e.g., 'FF0000' for red). :param font_name: Font name for the text. :param layout_index: Optional index of the slide layout to use for this slide. :return: A dictionary representing the slide content.
qs
¶
QS Support.
Adding support for Querysource related functions as datasource support to components.
QSSupport
¶
Bases: ABC
QSSupport.
Adding Support for Querysource parameters.
selenium_service
¶
SeleniumService
¶
Bases: ABC
SeleniumService.
Interface for making HTTP connections using Selenium.
get_driver
async
¶
Return a Selenium Driver instance for Firefox, Edge, Safari, WebKitGTK or Chrome.
This method configures the browser based on instance flags (such as: - self.use_firefox, self.use_edge, self.use_safari, self.use_webkit - self.use_proxy, self._free_proxy, self.use_undetected - self.as_mobile for mobile emulation (Chrome-only) - self.enable_http2 (if False, HTTP/2 will be disabled)
It applies a common set of options (stored in self.chrome_options) to all browsers and adds proxy settings (if configured) to the options and/or desired capabilities.
Returns:
| Type | Description |
|---|---|
|
A Selenium WebDriver instance. |
get_page
async
¶
get_page with selenium.
Get one page using Selenium.
search_google_cse
async
¶
Search Google Custom Search Engine (CSE) using Selenium.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search query. |
required |
max_results
|
int
|
Maximum number of search results to return. |
5
|
Returns:
| Type | Description |
|---|---|
|
list[dict]: A list of search results with 'title' and 'link'. |
smartsheet
¶
SmartSheet.
Making operations over an Smartsheet Service.
SmartSheetClient
¶
Bases: CredentialsInterface
http_get
async
¶
http_get(url=None, credentials=None, headers={}, accept='application/vnd.ms-excel', destination=None)
session. connect to an http source using aiohttp
stat
¶
StatSupport
¶
Bases: ABC
StatSupport.
Adding Support for Task Monitor (Statistics Collector.)
task
¶
Flowtask Task Execution.
template
¶
TemplateSupport
¶
Bases: ABC
TemplateSupport.
Adding Support for Jinja2 Template parser on Components.
vectorstores
¶
abstract
¶
AbstractStore
¶
Bases: ABC
AbstractStore class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embedding_model
|
dict
|
Embeddings. |
required |
milvus
¶
MilvusStore
¶
Bases: AbstractStore, CredentialsInterface
Interface for managing document storage in Milvus using LangChain.
create_collection
async
¶
create_collection(collection_name, origin=None, dimension=768, index_type='HNSW', metric_type='L2', **kwargs)
Create a Milvus collection based on an origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection_name
|
str
|
Name of the Milvus collection. |
required |
origin
|
Union[str, Path, Any]
|
None for minimal schema, Path for Avro file, or dataclass for schema. |
None
|
dimension
|
int
|
Dimension of the vector field. Defaults to 768. |
768
|
index_type
|
str
|
Index type for vector field. Defaults to "HNSW". |
'HNSW'
|
metric_type
|
str
|
Metric type for vector index. Defaults to "L2". |
'L2'
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Result of the collection creation. |
create_default_collection
async
¶
create_default_collection(collection_name, document=None, dimension=768, index_type=None, metric_type=None, schema_type='default', database=None, metadata_field=None, **kwargs)
create_collection.
Create a Schema (Milvus Collection) on the Current Database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection_name
|
str
|
Collection Name. |
required |
document
|
Any
|
List of Documents. |
None
|
dimension
|
int
|
Vector Dimension. Defaults to 768. |
768
|
index_type
|
str
|
Default index type of Vector Field. Defaults to "HNSW". |
None
|
metric_type
|
str
|
Default Metric for Vector Index. Defaults to "L2". |
None
|
schema_type
|
str
|
Description of Model. Defaults to 'default'. |
'default'
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
description |
delete_documents_by_attr
async
¶
Deletes documents in the Milvus collection that match a specific attribute.
This asynchronous method removes documents from a specified Milvus collection where the given attribute matches the provided value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection_name
|
str
|
The name of the Milvus collection to delete from. |
required |
attribute_name
|
str
|
The name of the attribute to filter on. |
required |
attribute_value
|
str
|
The value of the attribute to match for deletion. |
required |
Raises:
| Type | Description |
|---|---|
Exception
|
If the deletion operation fails, the error is logged and re-raised. |
Returns:
| Type | Description |
|---|---|
|
None |
Note
The method logs a notice with the number of deleted documents upon successful deletion.
load_documents
async
¶
load_documents(documents, upsert=True, collection=None, pk='source_type', dimension=768, index_type='HNSW', metric_type='L2', **kwargs)
Loads LangChain documents into the Milvus collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
documents
|
List[Document]
|
List of LangChain Document objects. |
required |
upsert
|
bool
|
If True, delete existing documents with matching attributes before inserting. |
True
|
pk
|
str
|
str: If upsert True, Key to be used for deleting documents before inserting. |
'source_type'
|
collection
|
str
|
Name of the collection. |
None
|
zammad
¶
zammad
¶
Bases: HTTPService
zammad
Overview
The `zammad` class provides a generic interface for managing Zammad instances via its RESTful API.
It extends the HTTPService class and offers methods for creating users and generating user tokens with
specific permissions in a Zammad instance. This class is pre-configured with the necessary Zammad instance
settings, such as tokens and default roles, making it easier to interact with the Zammad API.
.. table:: Properties :widths: auto
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| Name | Required | Description |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| credentials | No | A dictionary holding authentication credentials. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| auth | Yes | Authentication token for the Zammad API, derived from the ZAMMAD_TOKEN configuration. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| article_base | No | Default base dictionary for articles, specifying type and visibility. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| permissions_base | No | Base permissions for creating user tokens. |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
Return
The methods in this class facilitate interaction with the Zammad API, including creating users and generating
user access tokens. Each method returns the relevant response from the Zammad API, or an error if the operation fails.