# Path: src/moderations/tasks.py
# def async_get_request(url, params):
#     return requests.get(url, params)


from datetime import datetime
from django.http import HttpResponse
from accounts.models import AuthToken
from moderations.models import Moderation, ModerationAction
from moderations.utils import timedelta_to_str
from .tasks import async_get_request
import json
import pprint
import re
import requests
import traceback
                'token': access_token,
                'channel': channel_id,
                'text': text,
                'attachments': json.dumps(attachments),
                'unfurl_links': False,
                'unfurl_media': is_image,
            }
            if in_channel:
                params['response_type'] = 'in_channel'

            if not async:
                return requests.get(url='https://slack.com/api/chat.postMessage', params=params)
            else:
                return async_get_request(url='https://slack.com/api/chat.postMessage', params=params)
        except:
            print traceback.format_exe()

    @staticmethod
    def delete_message(access_token, channel_id, ts):
        return async_get_request(url='https://slack.com/api/chat.delete',
                                 params={
                                     'token': access_token,
                                     'ts': ts,
                                     'channel': channel_id,
                                 })

    @staticmethod
    def update_message(access_token, channel_id, ts,
                       text='', attachments=[]):


# Path: src/moderations/tasks.py
# def async_get_request(url, params):
#     return requests.get(url, params)


# Path: src/moderations/slack.py
from datetime import datetime
from django.http import HttpResponse
from accounts.models import AuthToken
from moderations.models import Moderation, ModerationAction
from moderations.utils import timedelta_to_str
from .tasks import async_get_request
import json
import pprint
import re
import requests
import traceback

                'token': access_token,
                'channel': channel_id,
                'text': text,
                'attachments': json.dumps(attachments),
                'unfurl_links': False,
                'unfurl_media': is_image,
            }
            if in_channel:
                params['response_type'] = 'in_channel'

            if not async:
                return requests.get(url='https://slack.com/api/chat.postMessage', params=params)
            else:
                return async_get_request(url='https://slack.com/api/chat.postMessage', params=params)
        except:
            print traceback.format_exe()

    @staticmethod
    def delete_message(access_token, channel_id, ts):
        return async_get_request(url='https://slack.com/api/chat.delete',
                                 params={
                                     'token': access_token,
                                     'ts': ts,
                                     'channel': channel_id,
                                 })

    @staticmethod
    def update_message(access_token, channel_id, ts,
                       text='', attachments=[]):


        return async_get_request(url='https://slack.com/api/chat.update',