Beispiel #1
0
            # 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
Beispiel #2
0
    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
Beispiel #3
0
            # 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)


# main
s = gl.Service(gl.DRIVER_PATH)
c = gl.Twenty20(s,
                timeout=4,
                refreshrate=0.000001,
                verbose=True,
                disablejs=True,
                incognito=True,
                disableimages=True,
                cache=4096,
                headless=False,
                proxy=None)
attemptconnection(c)

# backup sleep
time.sleep(1000000)  # Hack - leave it open to fill in details
        raise RuntimeError(
            "Requires chromedriver - set the path via env variable CHROMEDRIVER")

def attemptconnection(client, url):
    if client.establishconnection(url, phrases_to_check=PHRASES_TO_CHECK):
        print("success")
        print(client.attempts)
        print(client.content)
        gl.tofile(client.content, "reg_page_2020.html")
        if client.submit_registration(REG_DETAILS):
            print("Registration details submission success!")

            gl.tofile(client.pagesource, "payment_page_2020.html")
            # 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(DRIVER_PATH)
c = gl.Twenty20(s, timeout=2, refreshrate=0.01)
attemptconnection(c, DEPOSIT_20_URL)
Beispiel #5
0
import os
import glasto as gl

# test on reference HTML obtained from todays resale
URL = "file:///{}/ref/Buy%20tickets%20for%20Glastonbury%202019%20-%20Glastonbury.html".format(
    os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
URL = "http://localhost:3000/"
PHRASES_TO_CHECK = ["You are in"]#gl.Twenty20.REGISTRATION_PHRASE]


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")

def attemptconnection(client):
    if client.establishconnection(URL, phrases_to_check=PHRASES_TO_CHECK):
        print("success")
        print(client.attempts)
        client.clickbutton("Click me")
        
# main
s = gl.Service(DRIVER_PATH)
c = gl.Twenty20(s, timeout=4, refreshrate=0.000001, verbose=False)
attemptconnection(c)
input('...')