Ejemplo n.º 1
0
    def _parse_box(box):
        details = box.findAll('li')

        name = details[0].text.rstrip()

        price = details[1].span.text
        price = float(price[1:])

        cores = details[2].text
        cores = cores.split('\n')
        cores = int(cores[1][0])

        memory = details[4].text
        memory = float(memory[0])

        storage = details[3].text
        gb_index = storage.index('GB')
        storage = storage[0:gb_index]

        connection = details[6].text
        connection = int(connection[0])

        purchase_url = details[-1].p.span.a['href']

        return vps_hoster.VpsOption(name, cores, memory, storage, sys.maxsize,
                                    connection, price, purchase_url)
Ejemplo n.º 2
0
    def _parse_box(box):
        details = box.findAll('li')

        name = details[0].h4.text

        price = details[1].h1.text
        price = float(price[1:])

        cores = details[2].strong.text
        cores = int(cores.split(' ')[0])

        memory = details[3].strong.text
        memory = float(memory[0:-2])

        storage = details[4].strong.text
        if storage == '1TB':
            storage = 1000.0
        else:
            storage = float(storage[0:-2])

        connection = details[5].strong.text
        connection = int(connection[0:-7])

        purchase_url = details[9].a['href']

        return vps_hoster.VpsOption(name, cores, memory, storage, sys.maxsize, connection, price, purchase_url)