Merge branch 'master' of github:ryanmcgrath/twython

Conflicts:
	examples/block_spammer.py
	examples/block_user.py
	examples/unblock_user.py
	examples/unfollow_user.py
This commit is contained in:
Ben McGinnes 2014-08-06 01:05:01 +10:00
commit 5300373299
17 changed files with 319 additions and 235 deletions

View file

@ -1,20 +0,0 @@
from twython import Twython, TwythonError
# Optionally accept user data from the command line (or elsewhere).
#
# Usage: block_spammer.py SomeoneAnnoying
import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
twitter.report_spam(screen_name=target)
except TwythonError as e:
print(e)

View file

@ -1,20 +0,0 @@
from twython import Twython, TwythonError
# Optionally accept user data from the command line (or elsewhere).
#
# Usage: block_user.py A_Twitter_Troll
import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
twitter.create_block(screen_name=target, skip_status="true")
except TwythonError as e:
print(e)

View file

@ -9,7 +9,8 @@ import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
target = raw_input("User to follow: ")
# For Python 3.x use: target = input("User to follow: ")
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

View file

@ -8,5 +8,7 @@ except TwythonError as e:
print e
for tweet in search_results['statuses']:
print 'Tweet from @%s Date: %s' % (tweet['user']['screen_name'].encode('utf-8'), tweet['created_at'])
print 'Tweet from @%s Date: %s' % (tweet['user']['screen_nam\
e'].encode('utf-8'),
tweet['created_at'])
print tweet['text'].encode('utf-8'), '\n'

View file

@ -16,5 +16,7 @@ stream = MyStreamer(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
stream.statuses.filter(track='twitter')
#stream.user() # Read the authenticated users home timeline (what they see on Twitter) in real-time
#stream.site(follow='twitter')
# stream.user()
# Read the authenticated users home timeline
# (what they see on Twitter) in real-time
# stream.site(follow='twitter')

View file

@ -1,20 +0,0 @@
from twython import Twython, TwythonError
# Optionally accept user data from the command line (or elsewhere).
#
# Usage: unblock_user.py Not_So_Bad_After_All
import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
twitter.destroy_block(screen_name=target, skip_status="true")
except TwythonError as e:
print(e)

View file

@ -1,20 +0,0 @@
from twython import Twython, TwythonError
# Optionally accept user data from the command line (or elsewhere).
#
# Usage: unfollow_user.py Not_So_Cool_Really
import sys
if len(sys.argv) >= 2:
target = sys.argv[1]
else:
target = raw_input("User to follow: ") # For Python 3.x use: target = input("User to follow: ")
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
twitter.destroy_friendship(screen_name=target)
except TwythonError as e:
print(e)