marketing.utils

Copyright (C) 2021 Gitcoin Core

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

validate_slack_integration

validate_slack_integration(token, channel, message=None, icon_url='')

Validate the Slack token and channel combination by posting a message.

Args: token (str): The Slack API token. channel (str): The Slack channel to send the message. message (str): The Slack message to be sent. Defaults to: The Gitcoin Slack integration is working fine. icon_url (str): The URL to the avatar to be used. Defaults to: the gitcoin helmet.

Attributes: result (dict): The result dictionary defining success status and error message. error_messages (dict): The dictionary mapping of expected error result types. message (str): The response message to display to the user. sc (SlackClient): The slack client object. response (dict): The Slack response payload. error (str): The error code

Raises: SlackClientError: The exception is raised for any Slack-specific error.

Returns: str: The response message.

get_platform_wide_stats

get_platform_wide_stats(since_last_n_days=90)

Get platform wide stats for quarterly stats email.

Args: since_last_n_days (int): The number of days from now to retrieve stats.

Returns: dict: The platform statistics dictionary.

func_name

func_name()

Determine the calling function's name.

Returns: str: The parent method's name.