-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathticketer.py
More file actions
42 lines (36 loc) · 1.56 KB
/
ticketer.py
File metadata and controls
42 lines (36 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from threading import Thread
from datetime import datetime
import Queue, sys, os
q = Queue.Queue()
ticket_time = datetime(2016, 3, 28, 20, 0, 0, 0)
def get_tickets():
''' opens a new chrome application and clicks on the register then checkout button'''
# MANDATORY: include direct path to chromedriver here
driver = webdriver.Chrome(os.path.dirname(os.path.realpath(__file__)) + '/chromedriver')
# wait until time is equal or after ticket_time to open the site and click the buttons
while 1:
try:
# opens bacchanal eventbrite ticketing page
driver.get("https://www.eventbrite.com/e/bacchanal-2016-tickets-22507236751")
# click register button
register = driver.find_element(By.XPATH, '//*[@id="event-page"]/main/div[1]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/form/span/span[2]/a').click()
# click checkout buton
checkout = driver.find_element(By.XPATH, '//*[@id="event-page"]/div[7]/div[2]/div/div/section[3]/div/div/div[3]/input').click()
except:
print("continuing")
continue
if __name__ == "__main__":
# attempt to get 5 tickets
for i in range(7):
# new thread for each ticket grabber
thread = Thread(target=get_tickets, args = '')
thread.start()
q.put(thread) # add the thread to the queue
try:
while 1:
pass
except KeyboardInterrupt:
sys.exit()