Created
October 15, 2020 12:42
-
-
Save osamu/51bbfd86529a95d232d24ebf5f77fe06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from random import choices | |
import random | |
from string import ascii_uppercase | |
import base64 | |
import json | |
import datetime | |
client = boto3.client('firehose') | |
while True: | |
data = { | |
'created_at' : str(datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9)))), | |
'ticker_symbol': "".join(choices(ascii_uppercase, k=3)), | |
'sector': 'tekito', | |
'change': random.random(), | |
'price': random.random() | |
} | |
print(data) | |
data_json = json.dumps(data) | |
client.put_record( | |
DeliveryStreamName="LogDelivery", | |
Record={'Data': bytes(data_json+"\n", 'utf-8')} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment