Python Forum

Full Version: Store twitter DM's in a .txt file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I made a bot on twitter for a social experiment and got around 30 accounts. Since its hard for me to check them all daily for messages, I'd like to get them of each account on a text file. Can anyone help me please?

from __future__ import print_function
from twitter import Twitter, OAuth, TwitterHTTPError
I use these libs

i'm pretty new to coding so some good explanation would be very helpful

thanks
if you are new, then don't start learning python2 (based on the fact that you import from __future__ ). start learning python3.
As to your project - we are glad to help, but we are not going to do it for you. Please, post your code in code tags and ask specific questions. If you get error, post the full traceback in error tags.
(Nov-16-2017, 07:52 AM)buran Wrote: [ -> ]if you are new, then don't start learning python2 (based on the fact that you import from __future__ ). start learning python3.
As to your project - we are glad to help, but we are not going to do it for you. Please, post your code in code tags and ask specific questions. If you get error, post the full traceback in error tags.

hey,
i'm using python 3, i guess its just from an old source or something...

i need help from this information: https://developer.twitter.com/en/docs/di...ist-events

i dont find twurl in my libaries and don't really know what "-X" is from this line: twurl -X GET /1.1/direct_messages/events/list.json


regards
twurl - https://github.com/twitter/twurl but it is ruby, not python
you may want to explore tweepy, python wrapper around Twitter API
here are direct message methods - http://tweepy.readthedocs.io/en/v3.5.0/a...ge-methods
(Nov-16-2017, 12:33 PM)buran Wrote: [ -> ]twurl - https://github.com/twitter/twurl but it is ruby, not python
you may want to explore tweepy, python wrapper around Twitter API
here are direct message methods - http://tweepy.readthedocs.io/en/v3.5.0/a...ge-methods

Hey, i have tried this:

import tweepy

API.direct_messages([since_id][, max_id][, count=10][, page][, full_text=True])

but i keep getting wrong syntax
(Nov-16-2017, 04:09 PM)buflek Wrote: [ -> ]Hey, i have tried this: import tweepy API.direct_messages([since_id][, max_id][, count=10][, page][, full_text=True]) but i keep getting wrong syntax


As I said, you need to read the docs, it will not work like this. http://tweepy.readthedocs.io/en/v3.5.0/g...arted.html