def _create_option():
     return VpsOption(name="Option name",
                      ram="Option ram",
                      cpu="Option cpu",
                      storage="Option storage",
                      bandwidth="Option bandwidth",
                      price=12,
                      currency="USD",
                      connection="Option connection",
                      purchase_url="Option url")
Example #2
0
 def parse_option(item):
     divs = item.findAll('div')
     return VpsOption(name=item.h4.text,
                      price=float(item.strong.text[1:]),
                      currency='USD',
                      connection=1000,
                      cpu=divs[2].strong.text[0],
                      ram=divs[3].strong.text.split(' ')[0],
                      bandwidth='unmetered',
                      storage=divs[4].strong.text.split(' ')[0],
                      purchase_url=item.a['href'])
 def parse_russia_options(info):
     return VpsOption(
         name=info[0].text.strip(),
         price=float(info[1].find('span').text.split('$')[1]),
         currency=determine_currency(info[1].find('span').text),
         cpu=int(info[2].contents[2].split('cores')[0]),
         ram=float(info[4].text.split("G")[0]),
         storage=float(info[3].text.split("G")[0]),
         bandwidth='unmetered',
         connection=int(info[6].text.split("G")[0]) * 1000,
         purchase_url=info[13].find('a')['href']
     )
Example #4
0
 def parse_cci_options(column):
     header = column.find('div', class_='phead')
     price = column.find('span', class_='starting-price')
     info = column.find('ul').findAll('li')
     return VpsOption(name=header.find('h2').contents[0],
                      price=float(price.contents[0]),
                      currency=determine_currency(
                          price.previous_sibling.strip()),
                      cpu=int(info[1].find('strong').contents[0]),
                      ram=float(info[2].find('strong').contents[0]),
                      storage=float(info[3].find('strong').contents[0]),
                      bandwidth=info[4].find('strong').contents[0].lower(),
                      connection=10,
                      purchase_url=column.find('a')['href'])
Example #5
0
 def parse_kvm_option(plan, name):
     elements = plan.findAll("div", {'class': 'info'})
     option = VpsOption(
         name=name,
         storage=elements[0].text.split(' GB')[0],
         cpu=elements[1].text.split(' vCore')[0],
         ram=elements[3].text.split(' GB')[0],
         currency='EUR',
         bandwidth='unmetered',
         connection=int(elements[4].text.split(' GB')[0]) * 1000,
         price=float(
             plan.find('div', {
                 'class': 'plans-price'
             }).span.text.replace('\u20AC', '')),
         purchase_url=plan.a['href'],
     )
     return option
Example #6
0
    def parse_clown_options(column):
        elements = column.findAll('td')
        ram = elements[1].text.split('<br>')[0]
        ram = float(ram.split('M')[0]) / 1024
        price = elements[6].text
        price = price.split("<br>")[0]
        price = price.split('$')[1]
        price = float(price.split('/')[0])

        return VpsOption(
            name=elements[0].text,
            ram=ram,
            storage=float(elements[2].text.split('G')[0]),
            cpu=int(elements[3].text.split('v')[0]),
            bandwidth=CrownCloud.beautiful_bandwidth(elements[4].text),
            connection=int(elements[4].text.split('GB')[1].split('G')[0]) *
            1000,
            price=price,
            currency=determine_currency(elements[6].text),
            purchase_url=elements[7].find('a')['href'])
Example #7
0
    def _parse_box(box):
        """
        Parse a single hosting configuration
        :param box: Div containing hosting details
        :return: VpsOption containing hosting details
        """
        details = box.findAll('li')
        storage = details[4].strong.text
        if storage == '1TB':
            storage = 1024.0
        else:
            storage = float(storage.split('G')[0])

        connection = details[5].strong.text.split('G')[0]
        connection = int(connection) * 1000
        return VpsOption(name=details[0].h4.text,
                         price=float(details[1].h1.text.split('$')[1]),
                         currency=determine_currency(details[1].h1.text),
                         cpu=int(details[2].strong.text.split('C')[0]),
                         ram=float(details[3].strong.text.split('G')[0]),
                         storage=storage,
                         connection=connection,
                         bandwidth='unmetered',
                         purchase_url=details[9].a['href'])