tweepyアップデート

twitterでブロックしているユーザの一覧およびその解除をするpythonのスクリプトが動かなくなっていた。

C:\Users\t>python blocking.py
Traceback (most recent call last):
File "blocking.py", line 18, in <module>
results = api.blocks()
File "build\bdist.win32\egg\tweepy\binder.py", line 185, in _call
File "build\bdist.win32\egg\tweepy\binder.py", line 168, in execute
tweepy.error.TweepError: [{u'message': u'The Twitter REST API v1 will soon stop functioning. Please
migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.', u'code': 68}]


古いAPIのサポートが終わった、みたいなことを見かけたので動かなくなるんじゃないかと予想はしていた。
tweepyを使っているのだが、調べるとtweepyが新しいAPIに対応していたので更新しようとした。

C:\Users\t>easy_install tweepy
Searching for tweepy
Best match: tweepy 1.11
Processing tweepy-1.11-py2.7.egg
tweepy 1.11 is already the active version in easy-install.pth

Using c:\python27\lib\site-packages\tweepy-1.11-py2.7.egg
Processing dependencies for tweepy
Finished processing dependencies for tweepy


が、すでにインストールされています、となる。2.0が出ているのに・・・

easy_installで更新をするには -U をつけるということを知る。

C:\Users\t>easy_install -U tweepy
Searching for tweepy
Reading http://pypi.python.org/simple/tweepy/
Reading http://github.com/tweepy/tweepy
Reading http://github.com/joshthecoder/tweepy
Best match: tweepy 2.0
Downloading http://pypi.python.org/packages/2.7/t/tweepy/tweepy-2.0-py2.7.egg#md5=193993b0df7c4e28fb
a5bb457e401d91
Processing tweepy-2.0-py2.7.egg
Moving tweepy-2.0-py2.7.egg to c:\python27\lib\site-packages
Removing tweepy 1.11 from easy-install.pth file
Adding tweepy 2.0 to easy-install.pth file

Installed c:\python27\lib\site-packages\tweepy-2.0-py2.7.egg
Processing dependencies for tweepy
Finished processing dependencies for tweepy


無事、動くようになった。

その他、不完全ながらphpやperlで作った、webで使えるスクリプトもあるのだがそれらも全部動かなくなっている。

多分同じようにライブラリを更新すればいいのだと思うがメンドクサイからまた今度。