入門ソーシャルデータ
買った。
とりあえず写経と思いきや、easy_installで11004エラー発生。
デフォルトブラウザのプロキシ設定が問題、修正。
次にtwitterからデータ取得で、案の上エラー、他の人のブログを見て解決。
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import twitter >>> twitter_api = twitter.Twitter(domain="api.twitter.com", api_version='1') >>> trends = twitter_api.trends() >>> print trends [{u'locations': [{u'woeid': 1, u'name': u'Worldwide'}], u'created_at': u'2011-11 -29T14:14:43Z', u'trends': [{u'url': u'http://twitter.com/search/%22American%20A irlines%22', u'query': u'%22American%20Airlines%22', u'events': None, u'promoted _content': None, u'name': u'American Airlines'}, {u'url': u'http://twitter.com/s earch/%22Jack%20Del%20Rio%22', u'query': u'%22Jack%20Del%20Rio%22', u'events': N one, u'promoted_content': None, u'name': u'Jack Del Rio'}, {u'url': u'http://twi tter.com/search/%22Server%20Tanilli%22', u'query': u'%22Server%20Tanilli%22', u' events': None, u'promoted_content': None, u'name': u'Server Tanilli'}, {u'url': u'http://twitter.com/search/%23WhatMoviesTaughtMe', u'query': u'%23WhatMoviesTau ghtMe', u'events': None, u'promoted_content': None, u'name': u'#WhatMoviesTaught Me'}, {u'url': u'http://twitter.com/search/%22Song%20of%20the%20Year%22', u'quer y': u'%22Song%20of%20the%20Year%22', u'events': None, u'promoted_content': None, u'name': u'Song of the Year'}, {u'url': u'http://twitter.com/search/%23MomentsI CanNeverForget', u'query': u'%23MomentsICanNeverForget', u'events': None, u'prom oted_content': None, u'name': u'#MomentsICanNeverForget'}, {u'url': u'http://twi tter.com/search/%23overcapacity', u'query': u'%23overcapacity', u'events': None, u'promoted_content': None, u'name': u'#overcapacity'}, {u'url': u'http://twitte r.com/search/%22NO%20SJ%22', u'query': u'%22NO%20SJ%22', u'events': None, u'prom oted_content': None, u'name': u'NO SJ'}, {u'url': u'http://twitter.com/search/%2 2Mel%20Tucker%22', u'query': u'%22Mel%20Tucker%22', u'events': None, u'promoted_ content': None, u'name': u'Mel Tucker'}, {u'url': u'http://twitter.com/search/Te hran', u'query': u'Tehran', u'events': None, u'promoted_content': None, u'name': u'Tehran'}], u'as_of': u'2011-11-29T14:18:40Z'}] >>> [ trend[u'name'] for trend in trends[0]["trends"] ] [u'American Airlines', u'Jack Del Rio', u'Server Tanilli', u'#WhatMoviesTaughtMe ', u'Song of the Year', u'#MomentsICanNeverForget', u'#overcapacity', u'NO SJ', u'Mel Tucker', u'Tehran']
やっぱ会社だとプロキシの関係からか上手くいかんわー。