当前位置: 首页>>代码示例>>Python>>正文


Python API.update_status方法代码示例

本文整理汇总了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)
开发者ID:aratakokubun,项目名称:RaspiBot,代码行数:18,代码来源:TwitterIO.py

示例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)
开发者ID:ericoporto,项目名称:Chove-Agora,代码行数:12,代码来源:weathertwitter.py

示例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)
开发者ID:007Hamza,项目名称:BTP,代码行数:17,代码来源:test_api1.py

示例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)
开发者ID:KyosukeHagiwara,项目名称:Komiyama,代码行数:7,代码来源:Komiyama.py

示例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)
开发者ID:KyosukeHagiwara,项目名称:Komiyama,代码行数:6,代码来源:Komiyama.py

示例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')
#.........这里部分代码省略.........
开发者ID:007Hamza,项目名称:BTP,代码行数:103,代码来源:test_api1.py

示例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登录成功~~")
开发者ID:redswallow,项目名称:weibo-bigben,代码行数:21,代码来源:test_oauth.py


注:本文中的tweepy.api.API.update_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。