title: Python Flask - Get values from an API and print it to HTML
body: <p>I did make a question about this earlier today, but a few hours ago I realized that there is a new API for what I am trying to make. Now the problem is that I need to get every product name, sell price and buy price, and a few more stuff into my website. I have gotten this far so far:</p>
  
  <pre><code>import requests
  from flask import Flask, render_template
  
  full_list = list()
  
  app = Flask(__name__)
  
  f = requests.get(
      "https://api.hypixel.net/skyblock/bazaar?key=[key is supposed to be secret]").json()
  
  for x in product:
      buyPrice = f["products"][x]["buy_summary"][0]["pricePerUnit"]
  
      @app.route('/')
      def price():
          return render_template("index.html", product=product, buyprice=buyPrice)
  
      if __name__ == "__main__":
          app.run(debug=True)
  </code></pre>
  
  <p>The product API looks a bit like this, I can't post it all because it's very big:</p>
  
  <pre><code>{
      "products": {
          "product_id": "BROWN_MUSHROOM",
          "sell_summary": [
              "amount": 3865,
              "pricerPerUnit": 14.8,
              "orders": 2
          ],
          "buy_summary": [
              "amount": 704,
              "pricerPerUnit": 15.8,
              "orders": 1
          ],
          "quick_status": {
              "productId": "BROWN_MUSHROOM",
              "sellPrice": 14.527416975007378,
              "sellVolume": 915286,
              "sellMovingWeek": 23745501,
              "sellOrders": 40,
              "buyPrice": 15.898423574723452,
              "buyVolume": 673646,
              "buyMovingWeek": 8011243,
              "buyOrders": 54
      }
  }
  </code></pre>
  
  <p>Now what I want is "product_id", which could either be grabbed from the beginning or from the "quick_status", I also want pricePerUnit, Amount and Orders from buy/sell_summary. </p>
  
  <p>How do I do this? I have tried to store all values in a separate array named "price" and I used "price.append(buyPrice)" to add,  but it only added one product price, I would like to have every product price.</p>
  
  <p>It should end up being something like:</p>
  
  <ol>
  <li>PRODUCT_ID</li>
  <li>BUY PRICE: XXX</li>
  <li>SELL PRICE: XXX</li>
  <li>BUY ORDERS: X WITH AMOUNT OF X</li>
  <li>BUY ORDERS: X WITH AMOUNT OF X</li>
  <li>BUY VOLUME: XXX</li>
  <li>SELL VOLUME: XXX</li>
  </ol>
  
  <p>Of course I don't need the code for everything, just need a little help with how I extract these values from the API, and get it into my HTML code.</p>
  
  <p>Currently my HTML looks like this:</p>
  
  <pre><code>{% for item in product %}
      &lt;h1&gt;{{ item }}&lt;/h1&gt;
      {% endfor %}
  </code></pre>