我想将 twitter 提要添加到我的应用程序中。所以我下载了 python-twitter (with python-oauth) 和 django-syncr。安装了一切,现在呢?在我的主要观点中,我想执行 Twitter 同步。因此,查看软件包源代码和文档,我想出了这个顺序:
t = TwitterSyncr('name', 'pass') #: create TwitterSyncr for my user
t.syncUser('name') #: get info for user from twitter but why give name again ?
t.syncTwitterUserTweets('name') : #name again ?!
这行不通。我收到 HTTP 错误 401 - 没有授权,但名称和密码肯定是正确的。那我该怎么用呢?我需要来自 Twitter 的 API 密钥吗?其次,这段代码一步一步发生了什么?什么时候在私有方法中为 TweetUser 创建了我的 django 模型?每次我想将我的模型与高音用户同步时,我是否应该创建 TweetSyncr 模型?请帮忙。
链接到作者的简短说明:http: //jesselegg.com/archives/2008/02/19/django-syncr-synchronize-django-web/
Traceback:
File "/home/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/home/views.py" in landing
27. t.syncUser('username')
File "/home/syncr/tweet.py" in syncUser
53. user_obj = self._syncTwitterUser(self._getUser(user))
File "/home/syncr/tweet.py" in _getUser
26. tw_user = self.api.GetUser(user)
File "build/bdist.linux-x86_64/egg/twitter.py" in GetUser
1633. json = self._FetchUrl(url)
File "build/bdist.linux-x86_64/egg/twitter.py" in _FetchUrl
2032. url_data = opener.open(url, encoded_post_data).read()
File "/bin/python-2.6.1/lib/python2.6/urllib2.py" in open
389. response = meth(req, response)
File "/bin/python-2.6.1/lib/python2.6/urllib2.py" in http_response
502. 'http', request, response, code, msg, hdrs)
File "/bin/python-2.6.1/lib/python2.6/urllib2.py" in error
427. return self._call_chain(*args)
File "/bin/python-2.6.1/lib/python2.6/urllib2.py" in _call_chain
361. result = func(*args)
File "/bin/python-2.6.1/lib/python2.6/urllib2.py" in http_error_default
510. raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
Exception Type: HTTPError at /
Exception Value: