Skip to content

Instantly share code, notes, and snippets.

@osamu
Created October 15, 2020 12:42
Show Gist options
  • Save osamu/51bbfd86529a95d232d24ebf5f77fe06 to your computer and use it in GitHub Desktop.
Save osamu/51bbfd86529a95d232d24ebf5f77fe06 to your computer and use it in GitHub Desktop.
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