本文整理汇总了Python中tweepy.api.API.update_status方法的典型用法代码示例。如果您正苦于以下问题:Python API.update_status方法的具体用法?Python API.update_status怎么用?Python API.update_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tweepy.api.API
的用法示例。
在下文中一共展示了API.update_status方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tweet
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
class Tweet():
def __init__(self, auth):
self.auth = auth
self.api = API(auth)
def tweet_with_media(self, fn, status):
self.api.update_with_media(fn, status=status)
def update_with_media(self, fn, status, tweet_id):
# self.api.update_with_media(filename=fn, status=status, in_reply_to_status_id=tweet_id)
media = self.api.media_upload(fn)
self.api.update_status(status=status, reply_to_status_id=tweet_id, media_ids=[media.media_id])
def update(self, status, tweet_id):
self.api.update_status(status=status, reply_to_status_id=tweet_id)
示例2: tweet
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
def tweet(answer):
CONSUMER_KEY = config.get("auth", "CONSUMER_KEY")
CONSUMER_SECRET = config.get("auth", "CONSUMER_SECRET")
ACCESS_TOKEN = config.get("auth", "ACCESS_TOKEN")
ACCESS_TOKEN_SECRET = config.get("auth", "ACCESS_TOKEN_SECRET")
auth = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = API(auth)
result = api.update_status(status=answer)
示例3: _testoauth
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
def _testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test getting access token
auth_url = auth.get_authorization_url()
print 'Please authorize: ' + auth_url
verifier = raw_input('PIN: ').strip()
self.assert_(len(verifier) > 0)
access_token = auth.get_access_token(verifier)
self.assert_(access_token is not None)
# build api object test using oauth
api = API(auth)
s = api.update_status('test %i' % random.randint(0, 1000))
api.destroy_status(s.id)
示例4: update_reply
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
def update_reply(text, reply_id, screen_name):
auth = get_oauth()
api = API(auth)
st = "@" + str(screen_name) + " " + str(text)
api.update_status(status=st, in_reply_to_status_id=reply_id)
示例5: update_tweet
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
def update_tweet(text):
auth = get_oauth()
api = API(auth)
api.update_status(status=text)
示例6: TweepyAPITests
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
class TweepyAPITests(unittest.TestCase):
def setUp(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
auth.set_access_token(oauth_token, oauth_token_secret)
self.api = API(auth)
self.api.retry_count = 2
self.api.retry_delay = 5
def testhometimeline(self):
self.api.home_timeline()
def testfriendstimeline(self):
self.api.friends_timeline()
def testusertimeline(self):
self.api.user_timeline()
self.api.user_timeline('twitter')
def testmentions(self):
self.api.mentions()
def testretweetedbyme(self):
self.api.retweeted_by_me()
def testretweetedbyuser(self):
self.api.retweeted_by_user('twitter')
def testretweetedtome(self):
self.api.retweeted_to_me()
def testretweetsofme(self):
self.api.retweets_of_me()
def testretweet(self):
s = self.api.retweet(123)
s.destroy()
def testretweets(self):
self.api.retweets(123)
def testgetstatus(self):
self.api.get_status(id=123)
def testupdateanddestroystatus(self):
# test update
text = 'testing %i' % random.randint(0, 1000)
update = self.api.update_status(status=text)
self.assertEqual(update.text, text)
# test destroy
deleted = self.api.destroy_status(id=update.id)
self.assertEqual(deleted.id, update.id)
def testgetuser(self):
u = self.api.get_user('twitter')
self.assertEqual(u.screen_name, 'twitter')
u = self.api.get_user(783214)
self.assertEqual(u.screen_name, 'twitter')
def testsearchusers(self):
self.api.search_users('twitter')
def testme(self):
me = self.api.me()
self.assertEqual(me.screen_name, username)
def testfriends(self):
self.api.friends()
def testfollowers(self):
self.api.followers()
def testdirectmessages(self):
self.api.direct_messages()
def testsentdirectmessages(self):
self.api.sent_direct_messages()
def testsendanddestroydirectmessage(self):
# send
sent_dm = self.api.send_direct_message(username, text='test message')
self.assertEqual(sent_dm.text, 'test message')
self.assertEqual(sent_dm.sender.screen_name, username)
self.assertEqual(sent_dm.recipient.screen_name, username)
# destroy
destroyed_dm = self.api.destroy_direct_message(sent_dm.id)
self.assertEqual(destroyed_dm.text, sent_dm.text)
self.assertEqual(destroyed_dm.id, sent_dm.id)
self.assertEqual(destroyed_dm.sender.screen_name, username)
self.assertEqual(destroyed_dm.recipient.screen_name, username)
def testcreatedestroyfriendship(self):
enemy = self.api.destroy_friendship('twitter')
self.assertEqual(enemy.screen_name, 'twitter')
self.assertFalse(self.api.exists_friendship(username, 'twitter'))
friend = self.api.create_friendship('twitter')
#.........这里部分代码省略.........
示例7:
# 需要导入模块: from tweepy.api import API [as 别名]
# 或者: from tweepy.api.API import update_status [as 别名]
# -*- coding: utf-8 -*-
'''
Created on 2011-8-27
@author: redswallow
'''
from tweepy.auth import OAuthHandler
from tweepy.api import API
consumer_key="o2K22DnJqSG0STjRbLUA";consumer_secret ="SV7I5YxQ8ehDCEBnKmCHYMTJW0Z0MLt3kpEdW9KhaCo"
token="25798843-PyBwBx4AWqjUuSAm9yoKQuSvEtZQR78IEsuB7xGw";tokenSecret="nWhpP3g44eciBs0Db5SXQc8HJ0G53Rd2v4sAGJy3aTU"
#get_api
auth=OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(token, tokenSecret)
api=API(auth)
api.update_status(u"oauth登录成功~~")