route1io_connectors package

Submodules

route1io_connectors.aws module

AWS

This module contains convenience functionality for working with AWS.

References

AWS SDK for Python (Boto3)

https://aws.amazon.com/sdk-for-python/

route1io_connectors.aws.connect_to_s3(aws_access_key_id: str, aws_secret_access_key: str, region_name: str)

Returns a connection to s3 bucket via AWS

Parameters
  • aws_access_key_id (str) – AWS access key

  • aws_secret_access_key (str) – AWS secret access key

  • region_name (str) – Default region name

Returns

Connection to s3 bucket via AWS

Return type

s3

route1io_connectors.aws.download_from_s3(s3, bucket: str, key: str, filename: Optional[str] = None) List[str]

Download file via AWS s3 bucket and return the fpath to the local file

Parameters
  • s3 – Connection to s3 bucket

  • bucket (str) – Name of s3 bucket to download file from

  • key (str) – Remote filename to download from the bucket

route1io_connectors.aws.get_most_recent_filename(s3, bucket: str, prefix: str = '') str

Return the key name as it appears in s3 bucket of the most recently modified file in bucket

Parameters
  • s3 – Connection to AWS S3 bucket

  • bucket (str) – Name of the bucket that contains data we want

  • prefix (str, optional) – Prefix to filter data

Returns

Name of the most recently modified file as it appears in S3 bucket

Return type

key

route1io_connectors.aws.upload_to_s3(s3, bucket: str, filename: Union[str, Sequence[str]], key: Optional[Union[str, Sequence[str]]] = None) None

Uploads a file to AWS s3 bucket

Parameters
  • s3 – Connection to s3 bucket

  • filename (str) – Local filepath of file to be uploaded

  • bucket (str) – Name of s3 bucket to upload file to

  • key (str (optional)) – Remote filename to upload file as

route1io_connectors.gsheets module

route1io_connectors.sa360 module

route1io_connectors.slack module

Slack

This module contains code for sending messages to Slack via webhooks.

route1io_connectors.slack.slack_block_message(message: Dict[str, str], webhook: str) None

Send formatted block message to Slack

Parameters
  • message (Dict[str, str]) – Dictionary containing the formatted block message to be sent to Slack

  • webhook (str) – WebHook for sending the message to

route1io_connectors.slack.slack_message(message: str, webhook: str) None

Send plain message to Slack

Parameters
  • message (str) – Single string message to be sent to Slack

  • webhook (str) – WebHook for sending the message to

Module contents