title: Delete all messages of SQS using Python
body: <p>I am having a Amazon SQS queue holding n number of messages, I want to delete the messages from the queue using a python code. My current code looks like:</p>
  
  <pre><code>import boto.sqs
  
  sqs = boto.sqs.connect_to_region("ap-southeast-1", aws_access_key_id='XXX', aws_secret_access_key='XXX')
  q = sqs.get_queue("grand_torm") #SQS queue name
  
  #text_file = open('download.json', 'w')
  m = q.read(visibility_timeout=15)
  if m == None:
      print "No message!"
  else:
      count = 0 
      while (count &lt; 50):
          q.delete_message(m)
          print "DELETED"
  </code></pre>
  
  <p>But this only deletes one message at a time, only "DELETED" gets to be printed 50 times. What am I missing here ?</p>