title: HTTPError: HTTP Error 400: Bad Request
body: <p>I've writtin this python script to get stock quotes from google finance. The script works as written however, if I enter a stock symbol that google does not have I get the HTTPError. I'm a beginner in python programming and not sure how to handle the HTTPError in the script. I have looked at other questions asked and none apply or able to help me in my quest.</p>
  
  <pre><code>import json
  import urllib2
  
  url = 'https://finance.google.com/finance/info?client=ig&amp;q=%s' % symbol
  lines = urllib2.urlopen(url).read().splitlines()
  j = json.loads(''.join([x for x in lines if x not in ('// [', ']')]))        
  bot.say('%s %s: (%s) %s' % (
          j['t'],
          j['l'],
          j['c'],
          j['lt']
   ))
  </code></pre>