twitter应用程序接口-
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了twitter应用程序接口-相关的知识,希望对你有一定的参考价值。
#Twitterã‹ã‚‰ã‚るユーザã®ç›´è¿‘ã®è³ªå•ã‚’ã¨ã£ã¦ãã‚‹ import datetime import locale from datetime import timedelta def GetresponseTwitter(): #urlä½œæˆ d=datetime.datetime.today() dt1 = timedelta(seconds=60*60*9)#twitterã®æ™‚刻ã¯9æ™‚é–“å‰ dt2 = timedelta(seconds=const_time) new_d = d-dt1-dt2#10分å‰ã®æ™‚刻をå–å¾— since=sinceParm(new_d)#sinceパラメータã®ä½œæˆ url = 'http://twitter.com/statuses/replies.xml?since=%s'%since base64string =b64encode("%s:%s" % (username, password))#username,passwordã¯è‡ªåˆ†ã§å®šç¾©ã™ã‚‹ã“㨠headers = {"Authorization": "Basic %s" % base64string} xml_result=urlfetch.fetch(url, payload='', method=urlfetch.POST, headers=headers).content result=[] for soup in BeautifulSoup(xml_result)('status'): try: text=htmlentity2unicode(soup('text')[0](text = True)[0].split(' ')[1]) except: print >>sys.stderr,'text=%s'%htmlentity2unicode(soup('text')[0](text = True)[0].split(' ')[1]) text=htmlentity2unicode(soup('text')[0](text = True)[0].split(' ')[1]) user=htmlentity2unicode(soup('screen_name')[0](text = True)[0]) result.append([text,user]) return result
以上是关于twitter应用程序接口-的主要内容,如果未能解决你的问题,请参考以下文章
通过rest接口获取自增id (twitter snowflake算法)