Fixed .urban, added % to stock.py - Thank you @Atheuz :) (original commit: 68e5535ca4)

This commit is contained in:
Luke Rogers 2012-06-04 02:41:19 +12:00
parent f8b05e6b6d
commit f589133d80
4 changed files with 8 additions and 5 deletions

View file

@ -4,12 +4,12 @@ grabs a machine gun and riddles <who>'s body with bullets.
gags and ties <who> then throws them off a bridge.
crushes <who> with a huge spiked boulder.
glares at <who> until they die of boredom.
shivs <who> in the <body> multiple times.
shivs <who> in the <body> a few times.
rams a rocket launcher up <who>'s ass and lets off a few rounds.
crushes <who>'s skull in with a spiked mace.
unleashes the armies of Isengard on <who>.
gags and ties <who> then throws them off a building to their death.
reaches out and punches right though <who>'s chest.
reaches out and punches right through <who>'s chest.
slices <who>'s <body> off with a sharpened Katana.
throws <who> to Cthulu and watches them get ripped to shreds.
feeds <who> to an owlbear who then proceeds to maul them violently.

View file

@ -28,7 +28,7 @@ def stock(inp):
results['color'] = "3"
ret = "%(company)s - %(last)s %(currency)s " \
"\x03%(color)s%(change)s (%(perc_change)s)\x03 " \
"\x03%(color)s%(change)s (%(perc_change)s%%)\x03 " \
"as of %(trade_timestamp)s" % results
if results['delay'] != '0':

View file

@ -23,7 +23,7 @@ def urban(inp):
# fetch the definitions
url = 'http://www.urbandictionary.com/iphone/search/define'
page = http.get_json(url, term=input)
page = http.get_json(url, term=input, referer="http://m.urbandictionary.com")
defs = page['list']
if page['result_type'] == 'no_results':

View file

@ -42,7 +42,7 @@ def get_json(*args, **kwargs):
def open(url, query_params=None, user_agent=None, post_data=None,
get_method=None, cookies=False, **kwargs):
referer=None, get_method=None, cookies=False, **kwargs):
if query_params is None:
query_params = {}
@ -60,6 +60,9 @@ def open(url, query_params=None, user_agent=None, post_data=None,
request.get_method = lambda: get_method
request.add_header('User-Agent', user_agent)
if referer is not None:
request.add_header('Referer', referer)
if cookies:
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))