2012-05-30 30 views
0

我試圖通過Tweepy查看我的Twitter列表中的成員列表。當我嘗試訪問我的django應用程序中的頁面時,出現以下錯誤。但是當我嘗試檢查shell終端(manage.py shell)時,它會顯示列表中的成員。Django:Tweepy API不工作

我該如何解決這個問題?

 TweepError at /list/ 
     [{u'message': u'Sorry, that page does not exist', u'code': 34}] 
     Request Method: GET 
     Request URL: http://127.0.0.1:8000/list/ 
     Django Version: 1.4 
     Exception Type: TweepError 
     Exception Value: [{u'message': u'Sorry, that page does not exist', u'code': 34}] 
     Exception Location: build\bdist.win32\egg\tweepy\binder.py in execute, line 168 
     Python Executable: C:\Python27\python.exe 
     Python Version: 2.7.3 
     Python Path: ['C:\\Python27\\Scripts\\crack', 
        'C:\\Python27\\lib\\site-packages\\django_social_auth-0.6.9-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\python_openid-2.2.5-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\oauth2-1.5.211-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\httplib2-0.7.4-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\tweepy-1.9-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\django_pagination-1.0.7-py2.7.egg', 
        'C:\\Python27\\lib\\site-packages\\django_imagekit-2.0.1-py2.7.egg', 
        'C:\\Windows\\system32\\python27.zip', 
        'C:\\Python27\\DLLs', 
        'C:\\Python27\\lib', 
        'C:\\Python27\\lib\\plat-win', 
        'C:\\Python27\\lib\\lib-tk', 
        'C:\\Python27\\lib\\site-packages\\PIL'] 
     Server time: Wed, 30 May 2012 10:07:07 +0100 

查看

 def listmem(request): 
      Users= api.list_members(owner=request.user, slug='map') 
      for User in Users: 
       print User 
      return render_to_response('listmember.html',{'Users': Users},context_instance=RequestContext(request)) 

模板

  {% block content %} 
      {% for User in Users %} 

       <p> <img src={{ User.profile_image_url }} /> {{ User.screen_name}}<a> </p> 
      {% endfor %} 

      {% endblock %} 

回答

1

你肯定所有者(從request.user拍攝)和蛞蝓是正確的?

Twitter響應告訴你,找不到資源(本例中爲列表),所以其中一個不正確。

+0

是的,我很確定! – picomon

+0

其他可能性:已驗證與未驗證(對於私人列表很重要),並且仍然request.user不是您期望的類型。 –

+0

,當我使用django 1.3時,它可以工作。更新到1.4後,我開始得到這個錯誤。現在不知道該怎麼辦。 – picomon