Additional work
This commit is contained in:
parent
1b622c62c9
commit
3b3f6192f2
|
@ -88,7 +88,7 @@ def read_csv(csv_path):
|
||||||
reader = csv.reader(f)
|
reader = csv.reader(f)
|
||||||
header = next(reader)
|
header = next(reader)
|
||||||
for row in reader:
|
for row in reader:
|
||||||
rows.append(dict(zip(header, row)))
|
rows.append(dict((key, val) for (key, val) in zip(header, row) if val))
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,8 @@ def classify_costs(csv_path):
|
||||||
cost = decimal.Decimal(item["lineItem/UnblendedCost"])
|
cost = decimal.Decimal(item["lineItem/UnblendedCost"])
|
||||||
if not cost:
|
if not cost:
|
||||||
continue
|
continue
|
||||||
breakpoint()
|
category = f"{item['lineItem/LineItemType']} - {item['lineItem/ProductCode']} - {item['lineItem/UsageType']} - {item.get('lineItem/ResourceId', '(no resource)')}"
|
||||||
|
print(f"{category} :: ${cost:.2f}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -108,7 +109,7 @@ def main():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
year, month = map(int, args.date.split("-"))
|
year, month = map(int, args.date.split("-"))
|
||||||
csv_path = get_csv(year, month, force_download=args.force_download)
|
csv_path = get_csv(year, month, force_download=args.force_download)
|
||||||
analyze(csv_path)
|
classify_costs(csv_path)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue