def run(i): s = gl.Service(DRIVER_PATH) c = gl.Twenty19(s, timeout=3, refreshrate=i * 0.05) if c.establishconnection(DEPOSIT_19_URL[min(i, len(DEPOSIT_19_URL) - 1)], phrases_to_check=PHRASES_TO_CHECK): print("success") print(c.attempts) print(c.timeout)
# we cannot go beyond this automated, # since entering credit cards details automatically # is terribly risky. # instead leave the page open for us to do that # and save the content # todo: ???? return else: print("Registration details submission failed!") # try again?? # attemptconnection(client, url) # main s = gl.Service(gl.DRIVER_PATH) c = gl.Twenty20(s, timeout=4, refreshrate=refreshrate, verbose=False, disablejs=disablejs, incognito=incognito, disableimages=disableimages, cache=cache, headless=headless, proxy=proxy) attemptconnection(c, DEPOSIT_20_URL) # backup sleep time.sleep(1000000) # Hack - leave it open to fill in details
def Init_Ui(self): # incognito?? incognito = True # disable js?? disablejs = False # disable images for faster loading? disableimages = True # change cache size? cache = 4096 # try a proxy with "8.8.8.8:88" proxy = None # run without browser - kind of pointless but faster. headless = False # refresh rate - seconds refreshrate = 0.0001 # try one of these URLS # DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/glastonbury-2020-deposits/worthy-farm/1300000" # DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/addregistrations" # DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/glastonbury-2020/worthy-farm/1300001" # DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/glastonbury-2020-ticket-coach-travel-deposits/worthy-farm/1450012" # DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/glastonbury-2020-ticket-coach-travel-deposits/worthy-farm/1450013" url_input = self.ui.lineEdit_13.text() if len(url_input) > 0: DEPOSIT_20_URL = "{}".format(url_input) else: DEPOSIT_20_URL = "https://glastonbury.seetickets.com/event/glastonbury-2020-deposits/worthy-farm/1450000" number1 = self.ui.numLE1.text() number2 = self.ui.numLE2.text() number3 = self.ui.numLE3.text() number4 = self.ui.numLE4.text() number5 = self.ui.numLE5.text() number6 = self.ui.numLE6.text() postCode1 = self.ui.postcodeLE1.text() postCode2 = self.ui.postcodeLE2.text() postCode3 = self.ui.postcodeLE3.text() postCode4 = self.ui.postcodeLE4.text() postCode5 = self.ui.postcodeLE5.text() postCode6 = self.ui.postcodeLE6.text() numbers = [number1, number2, number3, number4, number5, number6] postCodes = [ postCode1, postCode2, postCode3, postCode4, postCode5, postCode6 ] REG_DETAILS = [] for i in numbers: if len(i) > 0: for x in postCodes: if len(x) > 0: if postCodes.index(x) == numbers.index(i): REG_DETAILS.append({ 'number': "{}".format(i), 'postcode': "{}".format(x) }) else: # Default REG_DETAILS REG_DETAILS = [ { 'number': "123456789", 'postcode': "SW1 1SQ" }, { 'number': "123456780", 'postcode': "SW1 1SQ" }, ] # first is lead booker # REG_DETAILS=[ # { # 'number': "123456789", # 'postcode': "SW1 1SQ" # }, # { # 'number': "123456780", # 'postcode': "SW1 1SQ" # }, # ] if len(REG_DETAILS) == 0: raise RuntimeError("Must have at least one registration!") if len(REG_DETAILS) > 6: raise RuntimeError( "Cannot accept more than 1 + 5 registration details!") PHRASES_TO_CHECK = [gl.Twenty20.REGISTRATION_PHRASE] def attemptconnection(client, url): if client.establishconnection(url, phrases_to_check=PHRASES_TO_CHECK): print("success") print(client.attempts) try: gl.tofile(client.content, "reg_page_2020.html") except: pass if client.submit_registration(REG_DETAILS): print("Registration details submission success!") # save the html data try: gl.tofile(client.content, "reg_check_2020.html") except: pass try: # then click 'confirm' button and save html data again client.clickbutton('Confirm') gl.tofile(client.pagesource, "payment_page_2020.html") except: pass # we cannot go beyond this automated, # since entering credit cards details automatically # is terribly risky. # instead leave the page open for us to do that # and save the content # todo: ???? return else: print("Registration details submission failed!") # try again?? # attemptconnection(client, url) # main s = gl.Service(gl.DRIVER_PATH) c = gl.Twenty20(s, timeout=4, refreshrate=refreshrate, verbose=False, disablejs=disablejs, incognito=incognito, disableimages=disableimages, cache=cache, headless=headless, proxy=proxy) attemptconnection(c, DEPOSIT_20_URL) # backup sleep time.sleep(1000000) # Hack - leave it open to fill in details
import sys import glasto as gl URL = "https://glastonbury.seetickets.com/registration/lookup" PHRASES_TO_CHECK = [] try: from glasto._custom.driver import DRIVER_PATH except: import os DRIVER_PATH = os.getenv("CHROMEDRIVER", '') if not DRIVER_PATH: raise RuntimeError( "Requires chromedriver - set the path via env variable CHROMEDRIVER") s = gl.Service(DRIVER_PATH) c = gl.Twenty19(s, timeout=2, refreshrate=0.01) if c.establishconnection(URL, phrases_to_check=PHRASES_TO_CHECK): print("success") print(c.attempts) inputs = c.client.find_elements_by_tag_name('input') # loop to find email input found = False for i in inputs: if 'email' in i.get_attribute('name').lower(): i.send_keys("*****@*****.**") found = True if not found: