tweepy

Tweepy SSLError regarding ssl certificate

ぃ、小莉子 提交于 2019-11-30 23:54:05
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 Requests throwing up SSLError and set the following code ( verify = false ) may be a quick solution. Does

tweepy stream to sqlite database - invalid synatx

﹥>﹥吖頭↗ 提交于 2019-11-30 20:49:11
问题 The code below is streaming the twitter public timeline for a variable which output any tweets to the console. I'd like the save the same variables (status.text, status.author.screen_name, status.created_at, status.source) into an sqlite database. I'm getting an syntax error when my script sees a tweet and nothing is written to the sqlite database. the error: $ python stream-v5.py @lunchboxhq Filtering the public timeline for "@lunchboxhq"RT @LunchboxHQ: test 2 LunchboxHQ 2012-02-29 18:03:42

Getting whole user timeline of a Twitter user

不打扰是莪最后的温柔 提交于 2019-11-30 19:33:22
I want to get the all of a user tweets from one Twitter user and so far this is what I came up with: import twitter import json import sys import tweepy from tweepy.auth import OAuthHandler CONSUMER_KEY = '' CONSUMER_SECRET= '' OAUTH_TOKEN='' OAUTH_TOKEN_SECRET = '' auth = twitter.OAuth(OAUTH_TOKEN,OAUTH_TOKEN_SECRET,CONSUMER_KEY,CONSUMER_SECRET) twitter_api =twitter.Twitter(auth=auth) print twitter_api statuses = twitter_api.statuses.user_timeline(screen_name='@realDonaldTrump') print [status['text'] for status in statuses] Please ignore the unnecessary imports. One problem is that this only

Get twitter followers using tweepy and multiple API keys

*爱你&永不变心* 提交于 2019-11-30 15:45:15
问题 I have multiple twitter dev keys that I am using to get followers from a list of handles. There are two ways I can do this but have a problem with both. The first: try: .... for user in tweepy.Cursor(api.followers, screen_name=screenName).items(): .... except tweepy.TweepError as e: errorCode = e.message[0]['code'] if errorCode == 88: print "Rate limit exceeded." rotateKeys() The issue here is that every time I rotate keys, the for loop starts from scratch and starts getting the followers

Get twitter followers using tweepy and multiple API keys

若如初见. 提交于 2019-11-30 15:15:33
I have multiple twitter dev keys that I am using to get followers from a list of handles. There are two ways I can do this but have a problem with both. The first: try: .... for user in tweepy.Cursor(api.followers, screen_name=screenName).items(): .... except tweepy.TweepError as e: errorCode = e.message[0]['code'] if errorCode == 88: print "Rate limit exceeded." rotateKeys() The issue here is that every time I rotate keys, the for loop starts from scratch and starts getting the followers again. I tried to get around this but splitting the for loop: try: items = tweepy.Cursor(api.followers,

User ID to Username tweepy

吃可爱长大的小学妹 提交于 2019-11-30 11:44:21
Can someone please tell me how to get one username from one id on tweepy? I have looked everywhere and can't find anything. If you just have a user_id value you need to call the twitter API with the get_user(user_id) method . The returned User object will contain the username under screen_name. # steps not shown where you set up api u = api.get_user(783214) print u.screen_name If you already have the User object from another API call just look for the screen_name. You can use this code to get user screen name or user id To get user screen name from user id In [36]: import tweepy In [37]:

Exclude retweets from twitter streaming api using tweepy

天涯浪子 提交于 2019-11-30 10:27:30
When using the python tweepy library to pull tweets from twitter's streaming API is it possible to exclude retweets? For instance, if I want only the tweets posted by a particular user ex: twitterStream.filter(follow = ["20264932"]) but this returns retweets and I would like to exclude them. How can I do this? Thank you in advance. Just checking a tweet's text to see if it starts with 'RT' is not really a robust solution. You need to make a decision about what you will consider a retweet, since it isn't exactly clear-cut. The Twitter API docs explain that tweets with 'RT' in the tweet text

Tweepy twitter oauth authentication not returning oauth_verifier

不想你离开。 提交于 2019-11-30 09:24:48
问题 I am using a python library called "tweepy" for twitter. When I try to authorize the user, twitter is supposed to redirect to a callback url with auth_token and oauth_verifier. I am getting only auth_token in the url. Anyone else had the same problem? 回答1: Twitter only uses oauth_verifier (PINs) for desktop applications. For web applications, Twitter bypasses this and does not use it. You can re-check your application settings at http://dev.twitter.com/apps 来源: https://stackoverflow.com

Tweepy Streaming - Stop collecting tweets at x amount

半世苍凉 提交于 2019-11-30 07:15:02
问题 I'm looking to have the Tweepy Streaming API stop pulling in tweets after I have stored x # of tweets in MongoDB. I have tried IF and WHILE statements inside the class, defintion with counters, but cannot get it to stop at a certain X amount. This is a real head-banger for me. I found this link here: https://groups.google.com/forum/#!topic/tweepy/5IGlu2Qiug4 but my efforts to replicate this have failed. It always tells me that init needs an additional argument. I believe we have our Tweepy

Tweepy - Exclude Retweets

蹲街弑〆低调 提交于 2019-11-30 05:15:54
Ultimate goal is to use the tweepy api search to focus on topics (i.e docker) and to EXCLUDE retweets. I have looked at other threads that mention excluding retweets but they were completely applicable. I have tried to incorporate what I've learned into the code below but I believe the "if not" piece of code is in the wrong place. Any help is greatly appreciated. #!/usr/bin/python import tweepy import csv #Import csv import os # Consumer keys and access tokens, used for OAuth consumer_key = 'MINE' consumer_secret = 'MINE' access_token = 'MINE' access_token_secret = 'MINE' # OAuth process,