Added method to set credentials.
authorJosh Roesslein <jroesslein@gmail.com>
Mon, 13 Jul 2009 21:33:30 +0000 (16:33 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Mon, 13 Jul 2009 21:33:30 +0000 (16:33 -0500)
api.py

diff --git a/api.py b/api.py
index 120c295e843e8d9a5699449897e935f7d9e10bb6..526f32b66e9edc5aaed8b5cfa54f91f5cf403094 100644 (file)
--- a/api.py
+++ b/api.py
@@ -12,7 +12,7 @@ class API(object):
                 classes={'user': User, 'status': Status,
                 'direct_message': DirectMessage, 'friendship': Friendship}):
     if username and password:
-      self._b64up = base64.b64encode('%s:%s' % (username, password))
+      self.set_credentials(username, password)
     else:
       self._b64up = None
     self.host = host
@@ -20,6 +20,10 @@ class API(object):
     self.classes = classes
     self.username = username
 
+  def set_credentials(username, password):
+    self._b64up = base64.b64encode('%s:%s' % (username, password))
+    self.username = username
+
   """Get public timeline"""
   public_timeline = bind_api(
       path = '/statuses/public_timeline.json',