Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get_direct_message example #423

Merged
merged 1 commit into from Sep 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions get_direct_message example
@@ -0,0 +1,17 @@
from twython import Twython, TwythonError
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)


get_list = twitter.get_direct_messages()
#Returns All Twitter DM information which is a lot in a list format

dm_dict = get_list[0]
#Sets get_list to a dictionary, the number in the list is the direct message retrieved
#That means that 0 is the most recent and n-1 is the last DM revieved.
#You can cycle through all the numbers and it will return the text and the sender id of each

print dm_dict['text']
#Gets the text from the dictionary

print dm_dict['sender']['id']
#Gets the ID of the sender