HTTPでデータを読み込む (gzip対応) 参考: http://www.diveintopython.org/http_web_services/gzip_compression.html import urllib2, gzip, socket, StringIO # ソケットタイムアウト時間を設定 socket.setdefaulttimeout(30) # リクエストオブジェクトを構築 req = urllib2.Request('http://example.com/') # ヘッダを追加 req.add_header('Accept-encoding', 'gzip') req.add_header('User-agent', 'MyUserAgent (+http://example.com/robot.html)') # リクエストを送信し、レスポンスを読み