title: What is the fastest way to send thousands of post requests with Python?
body: <p>I want to make thousands of POST requests in the fastest possible way.  How can I do this with Python?</p>
  
  <p>So far I just have a for loop which calls the following function many times:</p>
  
  <pre><code>def post(word):
      data = json.dumps({"word":word})
      url = "http://127.0.0.1:8000/updateword"
      req = urllib2.Request(url, data, {'Content-Type': 'application/octet-stream'})
      response=None
      try:
          f = urllib2.urlopen(req)
          response = f.read()
          f.close()
      except urllib2.HTTPError, error:
          k= open('error.html','w')
          k.write(error.read())
          k.close()
      return response
  </code></pre>
  
  <p>Is there a better way to do this?</p>