From 3371594f8b0ea117c7f7dabf809d26441a443805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francis=20Gagn=C3=A9?= Date: Tue, 13 May 2014 00:29:54 -0400 Subject: [PATCH] Migrate to Python 3 --- captainhook.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/captainhook.py b/captainhook.py index 4202c2d..4995686 100755 --- a/captainhook.py +++ b/captainhook.py @@ -20,12 +20,12 @@ } } -username = raw_input('Enter github username: ') +username = input('Enter github username: ') password = getpass.getpass("Enter github.com password for '%s': " % (username,)) -org = raw_input('Enter github org: ') -server = raw_input("Enter irc server hostname: ") -room = raw_input("Enter #channel::key or #channel: ") -overwrite = raw_input("Overwrite existing hooks? [y/N] ") +org = input('Enter github org: ') +server = input("Enter irc server hostname: ") +room = input("Enter #channel::key or #channel: ") +overwrite = input("Overwrite existing hooks? [y/N] ") overwrite = overwrite == "Y" or overwrite == "y" hook['config']['server'] = server @@ -40,10 +40,10 @@ for org in j: name = org['name'] hurl = org['hooks_url'] - print name + print(name) ## Prompt if not doall: - inp = raw_input("Add hook for %s? [Y/n/a/q] " % (name,)) + inp = input("Add hook for %s? [Y/n/a/q] " % (name,)) if inp == "q": sys.exit(0) if inp == "a": @@ -55,7 +55,7 @@ ## Get all existing hooks hs = requests.get(hurl, auth=auth) if not hs.ok: - print " Failed:", name + print(" Failed:", name) continue hj = json.loads(hs.text or hs.content) ## Look for existing hook that matches this one @@ -71,10 +71,10 @@ headers = {'Content-type': 'application/json'} k = requests.post(hurl, auth=auth, data=json.dumps(hook), headers=headers) if k.ok: - print " Set hook for", name + print(" Set hook for", name) else: - print " Failed to set hook for", name + print(" Failed to set hook for", name) else: - print " Hook already exists for", name + print(" Hook already exists for", name) else: - print " Failed:", r + print(" Failed:", r)