Commit 8b8206d3 by diegolima

Real-time updates

1 parent 187c8958
Showing with 1 additions and 2 deletions
import urllib.request import urllib.request
import json import json
from pprint import pprint
TERM_ONDEMAND = 'JRTCKXETXF' #TODO: Find out where to get this from TERM_ONDEMAND = 'JRTCKXETXF' #TODO: Find out where to get this from
HOURLY_DIMENSION = '6YS6EN2CT7' #TODO: Find out where to get this from HOURLY_DIMENSION = '6YS6EN2CT7' #TODO: Find out where to get this from
with urllib.request.urlopen("https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json") as url: with urllib.request.urlopen("https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json") as url:
DATA = json.load(url) DATA = json.loads(url.read().decode())
for product in DATA["products"]: for product in DATA["products"]:
if DATA['products'][product]['productFamily'] == 'Compute Instance': if DATA['products'][product]['productFamily'] == 'Compute Instance':
sku = DATA['products'][product]['sku'] sku = DATA['products'][product]['sku']
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!