Skip to content

Commit

Permalink
Adding DM function to twitter helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgouldin committed Mar 5, 2011
1 parent 9fbd448 commit b345f98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions socialite/apps/twitter/helper.py
Expand Up @@ -64,3 +64,11 @@ def announce(access_token, message):
url = urlparse.urljoin(api_url, 'statuses/update.json')
q = get_mutable_query_dict({'status': message})
return simplejson.loads(oauth_client.request(url, access_token, method="POST", body=q.urlencode()))

def dm(access_token, user_id, message):
url = urlparse.urljoin(api_url, 'direct_messages/new.json')
q = get_mutable_query_dict({
'user_id': user_id,
'text': message,
})
return simplejson.loads(oauth_client.request(url, access_token, method="POST", body=q.urlencode()))

0 comments on commit b345f98

Please sign in to comment.