akamai的netstorage api通信工具包
NetStorageKit的Python项目详细描述
用法
tests详细描述了用法,但请考虑此上载 例子。
importnetstoragekitasns# NetStorage connection information# The host part is prepended to -nsu.akamaihd.net, i.e. mycdn-nsu.akamaihd.nettest=dict(key_name='abc',key='abcdefghijk1234'cpcode='12345',host='mycdn')# Create a Request instancerequest=ns.api.Request(test['key_name'],test['key'],test['cpcode'],test['host'])remote_path='media/images/products/123.jpg'local_path='/opt/data/products/123.jpg'# Upload the local path to the remote one (always relative to the CPCode)# The returned data is the XML returned by the API parsed as a python object# The response is the object as returned by the requests packagedata,response=request.upload(remote_path,local_path)
安装
发展
pip install autoenv pip install virtualenv virtualenv -p /usr/bin/python2.7.9 env source env/bin/activate python setup.py install # Run tests py.test tests.py
产量
pip install netstoragekit