pricing.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:sparksteps 作者: jwplayer 项目源码 文件源码
def get_demand_price(aws_region, instance_type):
    """Get AWS instance demand price.

    >>> print(get_demand_price('us-east-1', 'm4.2xlarge'))
    """
    soup = BeautifulSoup(urlopen(EC2_INSTANCES_INFO_URL), 'html.parser')
    table = soup.find('table', {'id': 'data'})
    row = table.find(id=instance_type)
    td = row.find('td', {'class': 'cost-ondemand-linux'})
    region_prices = json.loads(td['data-pricing'])
    return float(region_prices[aws_region])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号