#!/usr/bin/env python3 import configparser, os.path, tweepy, getpass if os.path.isfile("config.cfg"): print("config.cfg already exists. Please remove it before running this script.") exit(1) config = configparser.RawConfigParser() config.add_section("SB") print('''In order to use SBTools, we'll get you connected to ScriptzBase. We will need your username and password. Please note that these will be stored on your hard disk in plain text. Sadly ScriptzBase doesn't offer a better way for third party applications to authenticate... ''') unam = input("Username: ") pwrd = getpass.getpass("Password (not echoed back!): ") print() config.set("SB", "user", unam) config.set("SB", "pass", pwrd) print("Seems like everything worked out fine. Let's write that config file...") with open('config.cfg', 'wt') as cfg: config.write(cfg) print("We're all done. You can now use Twitools. Have fun!")