Created
October 31, 2019 11:46
-
-
Save shaikkhajaibrahim/accb5653472d0d0fe8ab17374f24c5ba to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python | |
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',"34.220.166.4"),current_iter_date) | |
fake_document = { | |
"user": "directdevops.blog", | |
"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 = requests.post(url, json=fake_document) | |
print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment