Import getpass from getpass, instead of using getpass.getpass everytime.

This commit is contained in:
Emmanuel Gil Peyrot 2014-08-16 22:37:29 +02:00 committed by Florent Le Coz
parent 882f984b26
commit 67ca2dd0f4
26 changed files with 53 additions and 53 deletions

View File

@ -152,7 +152,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = IoT_TestDevice(opts.jid,opts.password) xmpp = IoT_TestDevice(opts.jid,opts.password)

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -160,7 +160,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the CommandBot and register plugins. Note that while plugins may # Setup the CommandBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -163,7 +163,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.other is None: if opts.other is None:
opts.other = input("JID Providing Commands: ") opts.other = input("JID Providing Commands: ")
if opts.greeting is None: if opts.greeting is None:

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -135,7 +135,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.command is None: if opts.command is None:
opts.command = input("Admin command: ") opts.command = input("Admin command: ")

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -124,7 +124,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the CommandBot and register plugins. Note that while plugins may # Setup the CommandBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -130,7 +130,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.other is None: if opts.other is None:
opts.other = input("JID Providing custom stanza: ") opts.other = input("JID Providing custom stanza: ")

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -166,7 +166,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the Disco browser. # Setup the Disco browser.
xmpp = Disco(opts.jid, opts.password, args[1], args[2], args[0]) xmpp = Disco(opts.jid, opts.password, args[1], args[2], args[0])

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
import threading import threading
from optparse import OptionParser from optparse import OptionParser
@ -144,7 +144,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = AvatarDownloader(opts.jid, opts.password) xmpp = AvatarDownloader(opts.jid, opts.password)
xmpp.register_plugin('xep_0054') xmpp.register_plugin('xep_0054')

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -100,7 +100,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the EchoBot and register plugins. Note that while plugins may # Setup the EchoBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -84,7 +84,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Component JID: ") opts.jid = input("Component JID: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.server is None: if opts.server is None:
opts.server = input("Server: ") opts.server = input("Server: ")
if opts.port is None: if opts.port is None:

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -120,7 +120,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the GTalkBot and register plugins. Note that while plugins may # Setup the GTalkBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -110,7 +110,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = IBBReceiver(opts.jid, opts.password) xmpp = IBBReceiver(opts.jid, opts.password)

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -96,7 +96,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.receiver is None: if opts.receiver is None:
opts.receiver = input("Receiver: ") opts.receiver = input("Receiver: ")
if opts.filename is None: if opts.filename is None:

View File

@ -3,7 +3,7 @@
import sys import sys
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -44,12 +44,12 @@ logging.basicConfig(level=opts.loglevel,
if opts.old_jid is None: if opts.old_jid is None:
opts.old_jid = input("Old JID: ") opts.old_jid = input("Old JID: ")
if opts.old_password is None: if opts.old_password is None:
opts.old_password = getpass.getpass("Old Password: ") opts.old_password = getpass("Old Password: ")
if opts.new_jid is None: if opts.new_jid is None:
opts.new_jid = input("New JID: ") opts.new_jid = input("New JID: ")
if opts.new_password is None: if opts.new_password is None:
opts.new_password = getpass.getpass("New Password: ") opts.new_password = getpass("New Password: ")
old_xmpp = slixmpp.ClientXMPP(opts.old_jid, opts.old_password) old_xmpp = slixmpp.ClientXMPP(opts.old_jid, opts.old_password)

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -153,7 +153,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.room is None: if opts.room is None:
opts.room = input("MUC room: ") opts.room = input("MUC room: ")
if opts.nick is None: if opts.nick is None:

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -99,7 +99,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the PingTest and register plugins. Note that while plugins may # Setup the PingTest and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -109,7 +109,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.proxy_host is None: if opts.proxy_host is None:
opts.proxy_host = input("Proxy host: ") opts.proxy_host = input("Proxy host: ")
if opts.proxy_port is None: if opts.proxy_port is None:
@ -117,7 +117,7 @@ if __name__ == '__main__':
if opts.proxy_user is None: if opts.proxy_user is None:
opts.proxy_user = input("Proxy username: ") opts.proxy_user = input("Proxy username: ")
if opts.proxy_pass is None and opts.proxy_user: if opts.proxy_pass is None and opts.proxy_user:
opts.proxy_pass = getpass.getpass("Proxy password: ") opts.proxy_pass = getpass("Proxy password: ")
# Setup the EchoBot and register plugins. Note that while plugins may # Setup the EchoBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -151,7 +151,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if len(args) == 2: if len(args) == 2:
args = (args[0], args[1], '', '', '') args = (args[0], args[1], '', '', '')

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -112,7 +112,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
logging.info("Run this in conjunction with the pubsub_client.py " + \ logging.info("Run this in conjunction with the pubsub_client.py " + \
"example to watch events happen as you give commands.") "example to watch events happen as you give commands.")

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -131,7 +131,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
# Setup the RegisterBot and register plugins. Note that while plugins may # Setup the RegisterBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does # have interdependencies, the order in which you register them does

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
import threading import threading
from optparse import OptionParser from optparse import OptionParser
@ -132,7 +132,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = RosterBrowser(opts.jid, opts.password) xmpp = RosterBrowser(opts.jid, opts.password)

View File

@ -10,7 +10,7 @@
""" """
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
import slixmpp import slixmpp
@ -97,7 +97,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.to is None: if opts.to is None:
opts.to = input("Send To: ") opts.to = input("Send To: ")
if opts.message is None: if opts.message is None:

View File

@ -12,7 +12,7 @@
import os import os
import imghdr import imghdr
import logging import logging
import getpass from getpass import getpass
import threading import threading
from optparse import OptionParser from optparse import OptionParser
@ -132,7 +132,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
if opts.filepath is None: if opts.filepath is None:
opts.filepath = input("Avatar file location: ") opts.filepath = input("Avatar file location: ")

View File

@ -11,7 +11,7 @@
import sys import sys
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
try: try:
@ -122,7 +122,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
access_token = None access_token = None

View File

@ -2,7 +2,7 @@
import sys import sys
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
try: try:
@ -99,7 +99,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = LocationBot(opts.jid, opts.password) xmpp = LocationBot(opts.jid, opts.password)

View File

@ -2,7 +2,7 @@
import sys import sys
import logging import logging
import getpass from getpass import getpass
from optparse import OptionParser from optparse import OptionParser
try: try:
@ -111,7 +111,7 @@ if __name__ == '__main__':
if opts.jid is None: if opts.jid is None:
opts.jid = input("Username: ") opts.jid = input("Username: ")
if opts.password is None: if opts.password is None:
opts.password = getpass.getpass("Password: ") opts.password = getpass("Password: ")
xmpp = TuneBot(opts.jid, opts.password) xmpp = TuneBot(opts.jid, opts.password)