tweepy

How to get the image if we have path in pandas dataframe

蹲街弑〆低调 提交于 2020-01-16 18:06:05
问题 I have the path of images inside the pandas dataframe I need to get the images inside the dataframe if I have path of it is it possible inside the dataframe? I need to store the images in the dataframe column along with their path. This is how I have tried it but its not working. Also the image size is small its 50x50 from IPython.core.display import HTML image=df['profile'] def path_to_image_html(path): return '<img src="'+ path + '" style=height:50px;"/>' a=HTML(df.to_html(escape=False

In depth Twitter Search API in tweepy

筅森魡賤 提交于 2020-01-15 10:54:08
问题 I wanted to search for tweets "by keyword" from a "given screen name." Example, all tweets from "BBCNews" about "weather". Looking into Tweepy library, I found this code: tweepy.Cursor(api.search, q="weather", rpp=100, result_type="recent", include_entities=True, lang="en") However, how am I gonna filter the tweets such that they are only from BBCNews? Thank you in advance. 回答1: The list of options you can use to filter the tweets you find can be found here : https://dev.twitter.com/rest

In depth Twitter Search API in tweepy

不问归期 提交于 2020-01-15 10:54:05
问题 I wanted to search for tweets "by keyword" from a "given screen name." Example, all tweets from "BBCNews" about "weather". Looking into Tweepy library, I found this code: tweepy.Cursor(api.search, q="weather", rpp=100, result_type="recent", include_entities=True, lang="en") However, how am I gonna filter the tweets such that they are only from BBCNews? Thank you in advance. 回答1: The list of options you can use to filter the tweets you find can be found here : https://dev.twitter.com/rest

Stripping Line Breaks in Tweets via Tweepy

亡梦爱人 提交于 2020-01-14 10:32:56
问题 I'm looking pull data from the Twitter API and create a pipe separated file that I can do further processing on. My code currently looks like this: auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) out_file = "tweets.txt" tweets = api.search(q='foo') o = open(out_file, 'a') for tweet in tweets: id = str(tweet.id) user = tweet.user.screen_name post = tweet.text post = post.encode('ascii', 'ignore') post = post

tweepy error response status code 400

倖福魔咒の 提交于 2020-01-14 09:24:06
问题 I'm trying to write a simple twitter bot using python and tweepy. The code is as follows: import tweepy CONSUMER_KEY = 'xxxxxxxxxxxxxxxxx' CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxx' ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxxx' ACCESS_SECRET = 'xxxxxxxxxxxxxxxxx' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) api.update_status('hi') I get the following error: TweepError: Twitter error response: status code = 400 I would

Updated Twitter Direct Messages API with Tweepy

送分小仙女□ 提交于 2020-01-13 19:04:57
问题 Twitter updated their messages API (https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event) today and all of the Python code I had written via Tweepy relating to sending Direct Messages has stopped working and I can't seem to get it to work. This is the code I have right now: direct_message = api.send_direct_message(user=username, text=message_text) However, I am getting the following error response from Twitter: [{'code': 34, 'message': 'Sorry,

How to extract only texts in hashtag using tweepy?

独自空忆成欢 提交于 2020-01-11 04:04:05
问题 I want to extract hashtags for my sentiment analysis project, however I'm getting a list of dictionary containing all the hashtags along with their indices in the tweet. I only want the text. My code : data = tweepy.Cursor(api.search, q, since=a[i], until=b[i]).items() tweet_data = [] tweets = pd.DataFrame() tweets['Tweet_ID'] = map(lambda tweet: tweet['id'], tweet_data) tweets['Tweet'] = map(lambda tweet: tweet['text'].encode('utf-8'), tweet_data) tweets['Date'] = map(lambda tweet: time

Tweepy: ImportError: cannot import name Random

走远了吗. 提交于 2020-01-10 02:34:06
问题 I'm using Tweepy to send some messages to Twitter. I'm getting a long traceback from the API. The traceback settles at: ImportError: cannot import name Random I used Pip to install the latest version of Tweepy: Name: tweepy Version: 2.3.0 Location: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages Requires: When I call import tweepy I get this traceback: Traceback (most recent call last): File "/Users/dromard/Projects/Drop Playlist/drop.py", line 4, in

Py2exe, Runtimeerror with tweepy

…衆ロ難τιáo~ 提交于 2020-01-09 08:05:00
问题 I wanted to use the python plugin for twitter called tweepy. in my main.py file I just imported tweepy import tweepy My setup-file looks like this: from distutils.core import setup import py2exe setup( windows=[{ "script": 'main.py', }], options={ "py2exe": { "includes": ["sip", "tweepy"] } } ) When i execute python setupy.py py2exe via command line I get this repeating codeblock until I get an RuntimeError: maximum recursion depth exceeded in comparison. File "C:\Python34\lib\site-packages

Tweepy get retweeters returning max 100

隐身守侯 提交于 2020-01-06 07:14:59
问题 I am using Tweepy for getting all retweeters of a particular tweet. My code is as follows: for reTweet in api.retweets(<tweet_id>,100): print reTweet I tried to use pagination using tweepy cursor as follows: for status in tweepy.Cursor(api.retweets, <tweet_id>).items(): But it is showing raise TweepError('This method does not perform pagination') How to get all retweeters of a tweet using Tweepy API? 回答1: If you check the Twitter docs for GET statuses/retweets/:id you will see it says: