.tfw: deal gracefully with the case where no location is specified

master
mutantmonkey 2010-12-07 18:36:31 -05:00
parent c56aa15867
commit 50b570f542
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,9 @@ import lxml.html
def tfw(phenny, input): def tfw(phenny, input):
zipcode = input.group(2) zipcode = input.group(2)
if not zipcode:
# default to Blacksburg, VA
zipcode = "24060"
try: try:
req = urlopen("http://thefuckingweather.com/?zipcode=%s" % urlquote(zipcode)) req = urlopen("http://thefuckingweather.com/?zipcode=%s" % urlquote(zipcode))