From cf38c7c3de42b5bd7b2a3e3eb348dc8dae2fa234 Mon Sep 17 00:00:00 2001 From: Michael Helmick Date: Sat, 31 Mar 2012 20:16:30 -0400 Subject: [PATCH] POSTing works again, somehow it broke... :/ --- twython/twython.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/twython/twython.py b/twython/twython.py index a8a2660..a73c743 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -194,7 +194,7 @@ class Twython(object): self.client = requests.session(hooks={'pre_request': OAuthHook()}) if self.oauth_token is not None and self.oauth_secret is not None: - self.oauth_hook = OAuthHook(self.oauth_token, self.oauth_secret) + self.oauth_hook = OAuthHook(self.oauth_token, self.oauth_secret, header_auth=True) self.client = requests.session(hooks={'pre_request': self.oauth_hook}) # Filter down through the possibilities here - if they have a token, if they're first stage, etc. @@ -678,3 +678,18 @@ class Twython(object): if isinstance(text, (str, unicode)): return Twython.unicode2utf8(text) return str(text) + + +if __name__ == '__main__': + t_token = 'tWcBBbw1RPw1xqByfmuacA' + t_secret = '8OUkoA2aXr2gTMI2gx7oDgw46UuG6ez8wIqV980m4' + f_oauth_secret = '66XY3rAamLbwWC0KNwUG9QxdsnfPNZBji2UKNhVh4' + f_oauth_token = '29251354-UCmNcr9y3lflHqN9Gvwc7A0JlH0H4FOhO0JgJxS7t' + + t = Twython(twitter_token=t_token, + twitter_secret=t_secret, + oauth_token=f_oauth_token, + oauth_token_secret=f_oauth_secret) + + user = t.post('statuses/update', params={'status': 'Testing Twython Library'}) + print user