Python Forum
Store twitter DM's in a .txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Store twitter DM's in a .txt file
#1
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
Reply
#2
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.
Reply
#3
(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
Reply
#4
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
Reply
#5
(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
Reply
#6
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I scrape profile information from Twitter People search results? asdad 0 704 Nov-29-2022, 10:25 AM
Last Post: asdad
  Is it possible to write a python script to block twitter feeds? cubangt 0 837 Apr-07-2022, 04:14 PM
Last Post: cubangt
  Reducing JSON character count in Python for a Twitter Bot johnmitchell85 2 45,652 Apr-28-2021, 06:08 PM
Last Post: johnmitchell85
  how do i store then call a mp3 from sqlite3 .db file gr3yali3n 3 5,625 Dec-11-2020, 10:28 AM
Last Post: snippsat
  Regex text file to store data in list TheSithSiggi 1 1,497 Dec-03-2020, 04:46 PM
Last Post: bowlofred
  How do I store the data in another txt file blacklight 1 1,904 Jun-26-2020, 11:09 AM
Last Post: Larz60+
  ChatterBot: How to store unanswered question in a text file? animrehrm 0 1,877 May-16-2020, 06:00 AM
Last Post: animrehrm
  Twitter follower network gugatcgwgf 2 2,019 May-06-2020, 10:29 AM
Last Post: gugatcgwgf
  Read csv file, parse data, and store in a dictionary markellefultz20 4 4,485 Nov-26-2019, 03:33 PM
Last Post: DeaD_EyE
  I can't use file __init__ to store shared variables and classes in the package AlekseyPython 2 3,284 Feb-04-2019, 06:26 AM
Last Post: AlekseyPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020