From 50d23fee0fec4c35cebf857b91d54d238c03b06e Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 7 Apr 2010 13:17:21 -0400 Subject: [PATCH] Replaced hard-coded username and password with code to read from a config file. And yes, I've already changed the password. Bah. --- mytwitter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mytwitter.py b/mytwitter.py index 66392ca..ed9e699 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -2,7 +2,7 @@ # # Custom twitter client... mostly for learning Python -import sys, twitter, Tkinter, Pmw +import sys, twitter, Tkinter, Pmw, ConfigParser, os class TwitWindow: @@ -10,8 +10,10 @@ class TwitWindow: """ Display Tweets, post to twitter """ def __init__(self): - self.username = "gjalfr" - self.password = "fun4cabbage" + config = ConfigParser.ConfigParser() + config.read(os.path.expanduser("~/.mytwitter")) + self.username = config.get('global', 'username') + self.password = config.get('global', 'password') self.num_entries = 10 self.labels = []