"""AWS SQS backend"""

import json
import logging

import boto3

from notifications import default_settings as settings

from .base import BaseBackend


class AwsSqsLambdaBackend(BaseBackend):
    logger = logging.getLogger('django_notifs.backends.aws_sqs_lambda')

    def produce(self, provider, payload, context, countdown):
        queue_url = settings.NOTIFICATIONS_SQS_QUEUE_URL
        sqs = boto3.client('sqs')

        message = {
            'provider': provider,
            'payload': payload,
            'context': context,
        }

        sqs.send_message(
            QueueUrl=queue_url,
            MessageBody=json.dumps(message),
            DelaySeconds=countdown,
        )


class AwsSqsLambdaConsumer:
    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])

            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)

97d98da3304dffa3e01f1e65ab79dd4ea9af2a1b
<mask token>


class AwsSqsLambdaBackend(BaseBackend):
    <mask token>
    <mask token>


class AwsSqsLambdaConsumer:

    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])
            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)

<mask token>


class AwsSqsLambdaBackend(BaseBackend):
    <mask token>

    def produce(self, provider, payload, context, countdown):
        queue_url = settings.NOTIFICATIONS_SQS_QUEUE_URL
        sqs = boto3.client('sqs')
        message = {'provider': provider, 'payload': payload, 'context': context
            }
        sqs.send_message(QueueUrl=queue_url, MessageBody=json.dumps(message
            ), DelaySeconds=countdown)


class AwsSqsLambdaConsumer:

    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])
            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)

<mask token>


class AwsSqsLambdaBackend(BaseBackend):
    logger = logging.getLogger('django_notifs.backends.aws_sqs_lambda')

    def produce(self, provider, payload, context, countdown):
        queue_url = settings.NOTIFICATIONS_SQS_QUEUE_URL
        sqs = boto3.client('sqs')
        message = {'provider': provider, 'payload': payload, 'context': context
            }
        sqs.send_message(QueueUrl=queue_url, MessageBody=json.dumps(message
            ), DelaySeconds=countdown)


class AwsSqsLambdaConsumer:

    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])
            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)

<mask token>
import json
import logging
import boto3
from notifications import default_settings as settings
from .base import BaseBackend


class AwsSqsLambdaBackend(BaseBackend):
    logger = logging.getLogger('django_notifs.backends.aws_sqs_lambda')

    def produce(self, provider, payload, context, countdown):
        queue_url = settings.NOTIFICATIONS_SQS_QUEUE_URL
        sqs = boto3.client('sqs')
        message = {'provider': provider, 'payload': payload, 'context': context
            }
        sqs.send_message(QueueUrl=queue_url, MessageBody=json.dumps(message
            ), DelaySeconds=countdown)


class AwsSqsLambdaConsumer:

    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])
            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)

"""AWS SQS backend"""

import json
import logging

import boto3

from notifications import default_settings as settings

from .base import BaseBackend


class AwsSqsLambdaBackend(BaseBackend):
    logger = logging.getLogger('django_notifs.backends.aws_sqs_lambda')

    def produce(self, provider, payload, context, countdown):
        queue_url = settings.NOTIFICATIONS_SQS_QUEUE_URL
        sqs = boto3.client('sqs')

        message = {
            'provider': provider,
            'payload': payload,
            'context': context,
        }

        sqs.send_message(
            QueueUrl=queue_url,
            MessageBody=json.dumps(message),
            DelaySeconds=countdown,
        )


class AwsSqsLambdaConsumer:
    @classmethod
    def consume(cls, event, context):
        for record in event['Records']:
            message = json.loads(record['body'])

            provider = message['provider']
            payload = message['payload']
            context = message['context']
            AwsSqsLambdaBackend.consume(provider, payload, context)
