import os import time os environ AWS_PROFILE research sqs_client boto3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
import os
import time
os.environ['AWS_PROFILE'] = 'research'
sqs_client = boto3.client('sqs', 'us-east-1')
for i in range(10):
sqs_client.send_message(
QueueUrl=f'https://sqs.us-east-1.amazonaws.com/641113671333/lesson1_sergii_barabash',
MessageBody=f"message_{i}"
)
time.sleep(10)
message = sqs_client.receive_message(
QueueUrl=f'https://sqs.us-east-1.amazonaws.com/641113671333/lesson1_sergii_barabash',
MaxNumberOfMessages=10)
print(len(message))