title: Python HTTP Error 505: HTTP Version Not Supported
body: <p>I have the following code:</p>
  
  <pre><code>import re
  from re import sub
  
  import cookielib
  from cookielib import CookieJar
  import urllib2
  from urllib2 import urlopen
  
  cj = CookieJar()
  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  opener.addheaders=[('user-agent' , 'Safari/7.0.2')]
  
  def check(word):
      try:
          query = "select * from geo.places where text ='"+word+"'"
          sourceCode=opener.open('http://query.yahooapis.com/v1/public/yql?q='+query+'&amp;diagnostics=true').read()
          print sourceCode
      except Exception, e:
          print str(e)
          print 'ERROR IN MAIN TRY'
  
  myStr = ['I','went','to','Boston']
  for item in myStr:
          check(item)
  </code></pre>
  
  <p>I am trying to query <code>select * from geo.places where text = 'Boston'</code> (for example).</p>
  
  <p>I keep receiving this error:</p>
  
  <pre><code>    HTTP Error 505: HTTP Version Not Supported
      ERROR IN MAIN TRY
  </code></pre>
  
  <p>What can cause this error and how can I solve it?</p>