summaryrefslogtreecommitdiffstats
path: root/askbot/utils
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-15 08:46:12 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-15 08:46:12 -0400
commit5f03d518dcc07a610069cd37ed31c99626cb5c52 (patch)
treeb33ee134ca1e7619918cf92fd2beb365008ffb4a /askbot/utils
parent0d5b61161be04616973495ba39822e1af60a6f0b (diff)
downloadaskbot-5f03d518dcc07a610069cd37ed31c99626cb5c52.tar.gz
askbot-5f03d518dcc07a610069cd37ed31c99626cb5c52.tar.bz2
askbot-5f03d518dcc07a610069cd37ed31c99626cb5c52.zip
added "auto-tweet" feature
Diffstat (limited to 'askbot/utils')
-rw-r--r--askbot/utils/twitter.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/askbot/utils/twitter.py b/askbot/utils/twitter.py
new file mode 100644
index 00000000..1eba6147
--- /dev/null
+++ b/askbot/utils/twitter.py
@@ -0,0 +1,12 @@
+import urllib
+from askbot.deps.django_authopenid.util import OAuthConnection
+
+class Twitter(OAuthConnection):
+ def __init__(self):
+ super(Twitter, self).__init__('twitter')
+ self.tweet_url = 'https://api.twitter.com/1.1/statuses/update.json'
+
+ def tweet(self, text, access_token=None):
+ client = self.get_client(access_token)
+ body = urllib.urlencode({'status': text})
+ return self.send_request(client, self.tweet_url, 'POST', body=body)