本文整理汇总了Python中models.Tweet.state方法的典型用法代码示例。如果您正苦于以下问题:Python Tweet.state方法的具体用法?Python Tweet.state怎么用?Python Tweet.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Tweet
的用法示例。
在下文中一共展示了Tweet.state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tweet
# 需要导入模块: from models import Tweet [as 别名]
# 或者: from models.Tweet import state [as 别名]
def tweet(self, include, reply, data):
tweet=data.get("text", "")
log.info("In tweet(), ")
h = data.get('handler', None)
wrap = TW_API.get(h, None)
try:
if include:
inObj = Includable(include)
tweet = tweet+" "+str(inObj)
if reply:
q=reply.get('topic', None)
sr_list=SearchResult.objects.filter(query=q, autoPostStatus=None)[:1]
log.info("length sr_list: "+str(sr_list))
if len(sr_list)<1:
search = Searching()
search.search(data.get('handler'), reply.get('topic'))
log.info("reply input: "+str(reply))
r = Reply(reply)
tweetId = r.getTweetId()
screenName = r.getScreenName()
tweet=wrap.replyTweet(tweet, screenName, tweetId)
reply={"screenName": screenName, "tweetId": tweetId}
else:
log.info("about to post a tweet...")
try:
wrap.postTweet(tweet)
except Exception as e:
log.info("error in posting tweet, "+str(e))
log.info(("came here"))
tw = Tweet()
secret = TwitterSecret.objects.get(handler=h)
tw.handler=secret
tw.state="updated"
tw.uuid= uuid.uuid4()
tw.text=tweet
tw.save()
except Exception as e:
log.info("An err while posting tweet"+str(e))
return Response({'tweet':tweet, "reply":reply})