1

I have a working application that interacts with SQS using python 3.6 and I am required to upgrade the same to Python3.8. Locally, I am using elasticmq as part of the development.

I have a SQSWrapper class that initializes queues and associates sqs_client with each queue. So if I have 10 queues, I will be creating 10 sqs_clients.

Here is the extract of the code, that creates an sqs_client

from aiobotocore.session import get_session
def _create_sqs_client():
        '''
        Creates an SQS client using our botocore session.
        '''
        return get_session().create_client(
            'sqs', **_connection_details
        )

sqs_client = _create_sqs_client()
coro = sqs_client.send_message(
            QueueUrl=await self._get_queue_url(),
            MessageBody=self.dumps(message.data)
        )

result = await asyncio.wait_for(coro, self.API_TIMEOUT)

I am getting an error message here:

>       coro = sqs_client.send_message(
            QueueUrl=await self._get_queue_url(),
            MessageBody=self.dumps(message.data)
        )
E       AttributeError: 'ClientCreatorContext' object has no attribute 'send_message'

When I debugged, I came to see that sqs_client is

<aiobotocore.session.ClientCreatorContext object at 0x108cc3a30>

I see a warning as well:

sys:1: RuntimeWarning: coroutine 'AioSession._create_client' was never awaited

I am unsure what I am missing here, I would really appreciate if someone could help me to crack this one.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.