From 20dd9968b32308b99517684a1eccac814feeeb0d Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 4 Jun 2012 02:53:23 +1200 Subject: [PATCH] Added fix for old stock symbols, eg: APPL --- plugins/stock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/stock.py b/plugins/stock.py index 4b727d6..e08622f 100755 --- a/plugins/stock.py +++ b/plugins/stock.py @@ -2,13 +2,12 @@ import random from util import hook, http +url = 'http://www.google.com/ig/api' @hook.command def stock(inp): "stock -- Gets information about stock symbol ." - url = 'http://www.google.com/ig/api?stock=%s' - parsed = http.get_xml(url, stock=inp) if len(parsed) != 1: @@ -21,6 +20,9 @@ def stock(inp): # if we dont get a company name back, the symbol doesn't match a company if results['company'] == '': return "error: unknown ticker symbol (%s)" % inp + + if results['last'] == '0.00': + return "%s - last known stock value was 0.00 %s" % (results['company'], results['currency']) if results['change'][0] == '-': results['color'] = "5"