Exoscale Price API
Getting and generating prices for the Exoscale DBaaS offering is currently a very hand-knitted process, not much automation in place. Therefore, the documentation here is just some keyword style explanation.
-
Get upstream prices via the Exoscale API, see below for the URLs
-
With the following Python snippet CHF prices can be easily extracted into a CSV format:
import requests response = requests.get('https://portal.exoscale.com/api/pricing/dbaas-kafka') content = response.json()['chf'] for plan in content: print(f"{plan},{content[plan]}")
-
Feed that into the Google Spreadsheet "Application Catalog Service Pricing Calculation" (manual copy/paste)
-
Enrich the information with the data found on the Exoscale website
-
Convert the data from the Google Spreadsheet into a format which can be copy/pasted into the products.docs page with the Python snippet.
import requests import csv from contextlib import closing csvurl = "CHANGEME" content = { "PostgreSQL": [], "MySQL": [], "Redis": [], "Apache Kafka": [], "OpenSearch": [], "Service": [], "": [], } with closing(requests.get(csvurl, stream=True, allow_redirects=True)) as r: f = (line.decode('utf-8') for line in r.iter_lines()) reader = csv.reader(f, delimiter=',', quotechar='"') for row in reader: content[row[0]].append(row) for svc in content: if svc == "Service" or svc == "": continue print(svc) r = content[svc] for row in r: print(f"{row[1]},{row[2]},{row[3]},{row[4]},{row[5]},{row[8]},{row[9]}")
To get the
csvurl
: In the spreadsheet, go to File → Share → Publish to web → Link. Choose the correct tab, and publish it as CSV. That’s the URL you want.