twython

OSX Automator failing to run Python script with modules from shell

时间秒杀一切 提交于 2019-12-05 06:40:45
问题 I am trying to run a Python script that uses a few 3rd party modules (numpy, pandas, Twython) from Run Shell Script in OSX Automator. I wrote a hello_world.py script that runs successfully so I'm certain that the problem is due to the 3rd party modules. In Terminal, I can successfully execute: python Desktop/my_folder/myscript.py , however when I try to run the shell script below, the shell script fails. I run Python 2.7.7 from anaconda distribution. #!/Users/myName/anaconda/bin/python2.7 cd

How to pass oauth_callback value to oauth/request_token with Twython

你离开我真会死。 提交于 2019-12-05 03:22:50
问题 Twitter just recently made the following mandatory: 1) You must pass an oauth_callback value to oauth/request_token. It's not optional. Even if you have one already set on dev.twitter.com. If you're doing out of band OAuth, pass oauth_callback=oob . 2) You must pass along the oauth_verifier you either received from your executed callback or that you received hand-typed by your end user to oauth/access_token. Here is the twitter thread (https://dev.twitter.com/discussions/16443) This has

Testing the twitter app on local server in django with twython

与世无争的帅哥 提交于 2019-12-04 18:11:57
I am using the twython library , to do handshakes with twitter python library. And I am testing things on my local server, 127.0.0.1:8000 This is my first django view, that generates the twitter tokens for users. def twitter_auth(request): """ The view function that initiates the entire handshake. For the most part, this is 100% drag and drop. """ # Instantiate Twython with the first leg of our trip. twitter = Twython( settings.TWITTER_KEY, settings.TWITTER_SECRET, ) # Then send them over there, durh. tw_callback_url = request.build_absolute_uri(reverse('social_home')) twitter_auth = twitter

How to get twitter followers using Twython?

泪湿孤枕 提交于 2019-12-04 12:47:14
问题 I want to get a list of twitter followers/following of a particular user, when their screenname or user.id is specified. Can anyone please give the code snippet for it? Thanks. 回答1: I'm the author of Twython. There's two different methods you can use for this; one that returns just follower IDs ( get_followers_ids ), and one that returns the statuses/etc of a follower set ( get_followers_list ). Some example code for one would be like the following: from twython import Twython twitter =

Twitter API: How to exclude retweets when searching tweets using Twython

左心房为你撑大大i 提交于 2019-12-01 22:18:38
I'm trying to exclude retweets and replies in my Twython search. Here is my code: from twython import Twython, TwythonError app_key = "xxxx" app_secret = "xxxx" oauth_token = "xxxx" oauth_token_secret = "xxxx" naughty_words = [" -RT"] good_words = ["search phrase", "another search phrase"] filter = " OR ".join(good_words) blacklist = " -".join(naughty_words) keywords = filter + blacklist twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret) search_results = twitter.search(q=keywords, count=100) The problem is that the -RT function isn't really working. EDIT: I've tried @forge

Scrape User Location from Twitter

人盡茶涼 提交于 2019-12-01 04:21:36
I am trying to scrape latitude and longitude of user from Twitter with respect to user names. The user name list is a csv file with more than 50 names in one input file. The below are two trials that I have made by far. Neither of them seems to be working. Corrections in any one of the program or an entirely new approach is welcome. I have list of User_names and I am trying to lookup user profile and pull the geolocation from the profile or timeline. I could not find much of samples anywhere over Internet. I am looking for a better approach to get geolocations of users from Twitter. I could

Scrape User Location from Twitter

╄→гoц情女王★ 提交于 2019-12-01 01:40:25
问题 I am trying to scrape latitude and longitude of user from Twitter with respect to user names. The user name list is a csv file with more than 50 names in one input file. The below are two trials that I have made by far. Neither of them seems to be working. Corrections in any one of the program or an entirely new approach is welcome. I have list of User_names and I am trying to lookup user profile and pull the geolocation from the profile or timeline. I could not find much of samples anywhere

Using Twython to send a tweet, twitter api error

戏子无情 提交于 2019-11-28 17:38:24
I'm trying to make python send a tweet for me using Twython but for some reason everything I'm trying isn't working. I've followed the Twython README but still unable to acheive what I want. Below is my latest attempted code: from twython import Twython, TwythonError APP_KEY = "KEYHERE" APP_SECRET = "SECRETHERE" twitter = Twython(APP_KEY, APP_SECRET) auth = twitter.get_authentication_tokens() OAUTH_TOKEN = auth['oauth_token'] OAUTH_TOKEN_SECRET = auth['oauth_token_secret'] twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) try: twitter.update_status(status='See how easy

Using Twython to send a tweet, twitter api error

我是研究僧i 提交于 2019-11-27 10:37:23
问题 I'm trying to make python send a tweet for me using Twython but for some reason everything I'm trying isn't working. I've followed the Twython README but still unable to acheive what I want. Below is my latest attempted code: from twython import Twython, TwythonError APP_KEY = "KEYHERE" APP_SECRET = "SECRETHERE" twitter = Twython(APP_KEY, APP_SECRET) auth = twitter.get_authentication_tokens() OAUTH_TOKEN = auth['oauth_token'] OAUTH_TOKEN_SECRET = auth['oauth_token_secret'] twitter = Twython