tweepy

TweepError: Failed to parse JSON payload:

僤鯓⒐⒋嵵緔 提交于 2019-12-10 23:25:11
问题 I am trying to scrape twitter data but I am getting this error. How do it fix it ? I have referred couple of queries over internet but cannot relate the program. code: import tweepy from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener import pandas as pd import json import csv import sys import time reload(sys) sys.setdefaultencoding('utf8') ckey = 'abc' csecret = 'abc' atoken = 'abc' asecret = 'abc' OAUTH_KEYS = {'consumer_key':ckey, 'consumer

tweepy wait_on_rate_limit not working

那年仲夏 提交于 2019-12-10 19:12:12
问题 So, first off, I realize there's a number of questions regarding handling the twitter rate limits. I have no idea why, but none of the ones's I've found so far work for me. I'm using tweepy. I'm trying to get a list of all the followers of the followers of a user. As expected, I can't pull everything down all at once due to twitter's rate limits. I have tweepy v 3.5 installed and thus am referring to http://docs.tweepy.org/en/v3.5.0/api.html. To get the list of followers of the originating

Show retweeters of a Twitter status in Tweepy

北战南征 提交于 2019-12-10 18:27:34
问题 I've been trying to find a way of doing the equivalent of: retweeters_of('twitterstatusid') I can't see an explicit method in tweepy - and couldn't work out any other way of finding this. Any help appreciated. 回答1: Solved: results = api.retweeted_by('statusid') (This method was missing from documentation.) 来源: https://stackoverflow.com/questions/5688762/show-retweeters-of-a-twitter-status-in-tweepy

filtering of tweets received from statuses/filter (streaming API)

风流意气都作罢 提交于 2019-12-10 14:46:15
问题 I have N different keywords that i am tracking (for sake of simplicity, let N=3). So in GET statuses/filter, I will give 3 keywords in the "track" argument. Now the tweets that i will be receiving can be from ANY of the 3 keywords that i mentioned. The problem is that i want to resolve as to which tweet corresponds to which keyword. i.e. mapping between tweets and the keyword(s) (that are mentioned in the "track" argument). Apparently, there is no way to do this without doing any processing

401 Error when retrieving Twitter data using Tweepy

你离开我真会死。 提交于 2019-12-10 12:32:25
问题 I am trying to retrieve Twitter data using Tweepy, using that below code, but I'm returning 401 error, and I regenerate the access and secret tokens, and the same error appeared. #imports from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener #setting up the keys consumer_key = 'xxxxxxx' consumer_secret = 'xxxxxxxx' access_token = 'xxxxxxxxxx' access_secret = 'xxxxxxxxxxxxx' class TweetListener(StreamListener): # A listener handles tweets are the

Writing multiple JSON to CSV in Python - Dictionary to CSV

瘦欲@ 提交于 2019-12-10 10:43:45
问题 I am using Tweepy to stream tweets and would like to record them in a CSV format so I can play around with them or load them in database later. Please keep in mind that I am a noob, but I do realize there are multiple ways of handling this (suggestions are very welcome). Long story short, I need to convert and append multiple Python dictionaries to a CSV file. I already did my research (How do I write a Python dictionary to a csv file?) and tried doing this with DictWriter and writer methods.

Tweepy Connection broken: IncompleteRead - best way to handle exception? or, can threading help avoid?

落爺英雄遲暮 提交于 2019-12-09 23:53:52
问题 I am using tweepy to handle a large twitter stream (following 4,000+ accounts). The more accounts that I add to the stream, the more likely I am to get this error: Traceback (most recent call last): File "myscript.py", line 2103, in <module> main() File "myscript.py", line 2091, in main twitter_stream.filter(follow=USERS_TO_FOLLOW_STRING_LIST, stall_warnings=True) File "C:\Python27\lib\site-packages\tweepy\streaming.py", line 445, in filter self._start(async) File "C:\Python27\lib\site

Getting tweets by date with tweepy

本秂侑毒 提交于 2019-12-09 12:21:39
问题 I pulled the max amount of tweets allowed from USATODAY which was 3000. Now I want to create a script to automatically pull USATODAY's tweets at 11:59PM of every day. I was going to use the stream api but then I will have to keep it running the whole day. Can I get some insight on how to create a script where it runs the REST API every night at 11:59PM to pull the day's tweets? If not does anyone know how to pull tweets based on date? I was thinking about placing an ifelse statement in my for

Tweepy list_members python

断了今生、忘了曾经 提交于 2019-12-09 07:58:50
问题 I created a list on twitter and added a user to it. Then I finally figured out how to write the code without an error. I am a newbie. Then Lo and behold when i get data it is whacked out. I have no idea what to do with it. All I want is to get the usernames of everyone in the the list. Here is the code: the_list = api.list_members('username', 'listname') for user in the_list: print user Here is what I get: tweepy.models.User object at 0x90b78ec (0, 0) That doesn't look like list_members to me

Tweepy SSLError regarding ssl certificate

橙三吉。 提交于 2019-12-09 01:06:51
问题 I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",) My code is like this. auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True) I found this post Python