pep8 tweaks

This commit is contained in:
Luke Rogers 2012-03-13 07:13:32 +13:00
parent a1eb155b14
commit 923e829068
4 changed files with 18 additions and 11 deletions

View file

@ -2,6 +2,7 @@
from util import hook
import urllib2
@hook.command
def gitio(inp):
".gitio <url> [code] -- Shorten Github URLs with git.io. [code] is a optional custom short code."
@ -13,13 +14,14 @@ def gitio(inp):
except:
code = None
# if the first 8 chars of "url" are not "https://" then append "https://" to the url, also convert "http://" to "https://"
# if the first 8 chars of "url" are not "https://" then append
# "https://" to the url, also convert "http://" to "https://"
if url[:8] != "https://":
if url[:7] != "http://":
url = "https://" + url
else:
url = "https://" + url[7:]
url='url='+str(url)
url = 'url=' + str(url)
if code:
url = url + '&code=' + str(code)
req = urllib2.Request(url='http://git.io', data=url)
@ -31,7 +33,8 @@ def gitio(inp):
return "Failed to get URL!"
urlinfo = str(f.info())
# loop over the rows in urlinfo and pick out location and status (this is pretty odd code, but urllib2.Request is weird)
# loop over the rows in urlinfo and pick out location and
# status (this is pretty odd code, but urllib2.Request is weird)
for row in urlinfo.split("\n"):
if row.find("Status") != -1:
status = row