Python で Amazon ECS 4.0 にアクセスしてみる
参考にしたところ
- http://www.goodpic.com/mt/archives2/2004/10/amazon_ecs_401.html
- http://trac.atzm.org/index.cgi/wiki/PyAmazon
Python から Amazon E-Commerce Service (ECS) にアクセスするライブラリは、今のところこれくらいしか見つからない。
- pyamazon : http://www.josephson.org/projects/pyamazon/
- pyaws : http://sourceforge.net/projects/pyaws/
pyamazon は AWS 3.0 を使用する上に、仕様が微妙で使いにくい。
pyaws はドキュメントも見つけられなかった。
なので、Python の勉強を兼ねて作ってみた。(機能は貧弱なのでLiteとしておく...)
ECS のバージョン 2004-10-04 に対応してるけど、2006-11-14 でも動くっぽい。
ダウンロードはこちら → pyAmazonLite.py
Python 2.4 + ElementTree または Python 2.5 が必要です。
使い方
Amazon Webサービスの登録ID(Subscription ID)が必要。→ 登録はここ
簡単な使い方はこんな感じ。
>>> from pyAmazonLite import * >>> amazon = Amazon(license = '...') # your license key >>> result = amazon.search('Python') # search "Books" by default >>> print result.totalPages 2 >>> print result.totalResults 14 >>> print result.items[0].ASIN 4873112109 >>> print result.items[0].ItemAttributes.Title 初めてのPython 第2版