Skip to content

Commit

Permalink
ingest IPv4 prices
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Dec 5, 2024
1 parent 87c71c6 commit b5664b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/add_vendor.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def inventory_ipv4_prices(vendor):
# "region_id": ,
# "price": ,
# "currency": "USD",
# "unit": PriceUnit.HOUR,
# "unit": PriceUnit.MONTH,
# }
# )
return items
Expand Down
24 changes: 13 additions & 11 deletions src/sc_crawler/vendors/upcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,18 @@ def inventory_traffic_prices(vendor):


def inventory_ipv4_prices(vendor):
# ipv4_address
items = []
# for price in []:
# items.append(
# {
# "vendor_id": vendor.vendor_id,
# "region_id": ,
# "price": ,
# "currency": "USD",
# "unit": PriceUnit.HOUR,
# }
# )
prices = _client().get_prices()
for zone_prices in prices["prices"]["zone"]:
for k, v in zone_prices.items():
if k == "ipv4_address":
items.append(
{
"vendor_id": vendor.vendor_id,
"region_id": zone_prices["name"],
"price": v["price"] / 100,
"currency": "EUR",
"unit": PriceUnit.MONTH,
}
)
return items

0 comments on commit b5664b5

Please sign in to comment.