in python/bot.py [0:0]
def pricing(service, options=dict(), max=5):
log.info("[pricing] service: {0} options: {1}".format(
service, options))
try:
check_service(service)
pc = None
if 'region' in options:
pc = PricingContext(region=options['region'])
options.pop('region')
else:
pc = PricingContext(region='us-east-1')
pc.service = service
pc.add_attributes(options)
prices = get_prices(pc)
response = ''
i = 0
for p in prices:
response += "Rate Code: {0} price:\n```\n{1}\n```\n".format(
p, json.dumps(prices[p], indent=2, sort_keys=True))
if i >= max:
response += "*-= Hit MAX responses =-*"
break
i += 1
return response
except ValueError as ve:
return "Price for service '{0}' not yet supported.".format(service)