Exemplo n.º 1
0
def calculate_price_vpn(vpn_provider='mullvad'):
    # option is assumed to be the first one
    vpn_option = options(get_vpn_providers()[vpn_provider])[0]
    gateway = get_vpn_providers()[vpn_provider].get_gateway()
    btc_price = gateway.estimate_price(
        wallet_util.get_price(vpn_option.price, 'USD'))
    return btc_price
Exemplo n.º 2
0
def calculate_price_vpn(vpn_provider='azirevpn'):
    logger.log('vpn provider: %s' % vpn_provider, "cloudomate_controller")
    # option is assumed to be the first one
    vpn_option = options(get_vpn_providers()[vpn_provider])[0]
    gateway = get_vpn_providers()[vpn_provider].get_gateway()
    btc_price = gateway.estimate_price(
        wallet_util.get_price(vpn_option.price, 'EUR'))
    return btc_price
Exemplo n.º 3
0
def pick_provider(providers):
    """
    This method picks a provider based on the DNA o the agent.
    :param providers:
    :return:
    """
    provider = DNA.choose_provider(providers)
    gateway = get_vps_providers()[provider].get_gateway()
    option, price, currency = pick_option(provider)
    btc_price = gateway.estimate_price(wallet_util.get_price(price, currency))
    return provider, option, btc_price
Exemplo n.º 4
0
def calculate_price(provider, option):
    """
    Calculate the price of the chosen server to buy.
    :param provider: the provider chosen
    :param option: the option at the provider chosen
    :return: the price
    """
    vps_option = get_vps_option(provider, option)
    gateway = cloudomate_providers['vps'][provider].get_gateway()
    btc_price = gateway.estimate_price(
        wallet_util.get_price(vps_option.price, 'USD'))
    return btc_price
Exemplo n.º 5
0
def calculate_price(provider, option):
    """
    Calculate the price of the chosen server to buy.
    :param provider: the provider chosen
    :param option: the option at the provider chosen
    :return: the price
    """
    logger.log('provider: %s option: %s' % (provider, option),
               "cloudomate_controller")
    vps_option = options(cloudomate_providers['vps'][provider])[option]
    gateway = cloudomate_providers['vps'][provider].get_gateway()
    btc_price = gateway.estimate_price(
        wallet_util.get_price(vps_option.price, 'USD'))
    return btc_price
Exemplo n.º 6
0
def pick_provider(providers):
    """
    This method picks a provider based on the DNA o the agent.
    :param providers:
    :return:
    """
    from plebnet.agent.qtable import QTable

    qtable = QTable()
    qtable.read_dictionary(providers)
    chosen_option = qtable.choose_option(providers)

    gateway = get_vps_providers()[chosen_option["provider_name"]].get_gateway()
    btc_price = gateway.estimate_price(wallet_util.get_price(chosen_option["price"], chosen_option["currency"]))

    return chosen_option["provider_name"], chosen_option["option_name"], btc_price