title: Get and Post methods in Python (Flask)
body: <p>I'm new to Flask and web development, and I am trying to create a simple app where an array of integers is generated on the server and sent to the client. Here is some sample (working) code in app.py:</p>
  
  <pre><code>from flask import Flask, render_template, request, url_for
  
  import random
  
  
  app = Flask(__name__)
  
  
  @app.route('/')
  def form():
      s_abc = [random.random() for _ in range(40)]
      return render_template('abc.html', s_abc=s_abc)
  
  if __name__ == '__main__':
    app.run(debug=True)
  </code></pre>
  
  <p>And here is a (working) snippet of abc.html:</p>
  
  <pre><code>&lt;div&gt;
    {{s_abc}} 
  &lt;/div&gt;
  </code></pre>
  
  <p>My questions are: </p>
  
  <ol>
  <li><p>How does this work even though there are no GET/POST HTTP methods? I thought that get/post http methods were required for communication between the server and the client (as described here: <a href="http://www.tutorialspoint.com/http/http_methods.htm" rel="noreferrer">http://www.tutorialspoint.com/http/http_methods.htm</a>). However, my code works even though I did not write something like this:</p>
  
  <pre><code>@app.route('/', methods=['GET'])
  </code></pre></li>
  <li><p>Is there a way to rewrite this so that it uses POST? Apparently, POST is better for dealing with sensitive data, as described here: <a href="http://blog.teamtreehouse.com/the-definitive-guide-to-get-vs-post" rel="noreferrer">http://blog.teamtreehouse.com/the-definitive-guide-to-get-vs-post</a></p></li>
  </ol>
  
  <p>Thanks.</p>