a few small tweaks to puush

This commit is contained in:
Luke Rogers 2013-09-05 10:08:36 +12:00
parent 0f488665aa
commit e061427207

View file

@ -13,7 +13,7 @@ def make_string():
def check_url(code): def check_url(code):
try: try:
x = urllib2.urlopen(make_url(code)) urllib2.urlopen(make_url(code))
return True return True
except: except:
return False # sorry <3 return False # sorry <3
@ -28,9 +28,10 @@ def puush(inp):
"""puush [1-5] -- Returns a number of random puu.sh entries.""" """puush [1-5] -- Returns a number of random puu.sh entries."""
out = "" out = ""
num = 0 num = 0
if not inp: if not inp:
inp = "1" inp = "1"
if inp[0] not in "123456789": if not inp.isdigit():
out += "Defaulting to one: " out += "Defaulting to one: "
num = 1 num = 1
elif int(inp[0]) > 5: elif int(inp[0]) > 5:
@ -38,6 +39,7 @@ def puush(inp):
num = 5 num = 5
else: else:
num = int(inp[0]) num = int(inp[0])
images = [] images = []
for x in range(num): for x in range(num):
ran = make_string() ran = make_string()