2013-12-13 44 views
3

我正在用tweepy編寫一個Twitter應用程序,通過查看in_reply_to_status_ID來獲取推文。 一切工作正常的速率限制,幾分鐘後,我不得不再等15分鐘左右。tweepy(python):速率限制超出代碼88

這很奇怪,因爲我幾乎在幾個月前使用了幾乎相同的代碼,之前API 1.0已被棄用,它沒有速度限制問題。

有沒有一種我可以擺脫的已知方式,或者至少會增加費率限制? 還是有解決方法嗎?

好像很多人有這個麻煩,但無法找到一個明確的解決方案..

,我將不勝感激,如果你能有所幫助。

auth1 = tweepy.auth.OAuthHandler('consumer_token','consumer_secret') 
auth1.set_access_token('access_token','access_secret') 
api=tweepy.API(auth1) 

def hasParent(s): 
    #return true if s is not None, i.e., s is an in_reply_to_status_id numbe 
.... 

while hasParent(ps): 
    try: 
     parent=api.get_status(ps) 
    except tweepy.error.TweepError: 
     print 'tweeperror' 
     break 
    newparent = parent.in_reply_to_status_id 
     ...... 
    ps=newparent 
+0

完全相同的問題...沒有ü解決它呢? –

回答

1

我把限制和工作:

def index(request): 
    statuses = tweepy.Cursor(api.user_timeline).items(10) 
    return TemplateResponse(request, 'index.html', {'statuses': statuses}) 
+0

感謝您發表!您能否解釋您的答案背後的邏輯,以及它如何適用於我的案件? – ytrewq