Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from datetime import timedelta, date, datetime
import random
import string
import requests
import os
start_date = datetime(year=2019, month=8, day=15)
# 10 days of fake data
total_minutes = 60*24*10
for minute in range(total_minutes):
print("{} of {}".format(minute,total_minutes))
current_iter_date_unformated = start_date + timedelta(minutes=minute)
current_iter_date = current_iter_date_unformated.strftime("%Y-%m-%d")
url = "http://{}:9200/{}-fakeindex/fake".format(os.getenv('IP_ADDRESS',""),current_iter_date)
fake_document = {
"user": "",
"date_posted": current_iter_date_unformated.isoformat(),
"message": ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(20)),
"minute": minute
response =, json=fake_document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment