forked from timothymugayi/boto3-sqs-extended-client-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
28 lines (17 loc) · 922 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import base64
from sqs_client.SQSClientExtended import SQSClientExtended
# from string import ascii_letters, digits
# from random import choice
from sqs_client.config import (AWS_SQS_QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION)
if __name__ == '__main__':
sqs = SQSClientExtended(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, 'tiptapcode-sqs-data')
# _100mb_large_string = ''.join([choice(ascii_letters + digits) for i in range(104857600)])
# message = "_100mb_large_string"
message = None
with open("C:\\DjangoCourse\\Courses\\celery\\introduction-promo.mp4", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
message = encoded_string.decode("utf-8")
sqs.send_message(AWS_SQS_QUEUE_URL, message)
res = sqs.receive_message(AWS_SQS_QUEUE_URL)
for message in res:
sqs.delete_message(AWS_SQS_QUEUE_URL, message.get('ReceiptHandle'))