myjson的api包装
myjson的Python项目详细描述
使用此python包装器快速、自由地托管json数据,用于mysjon.com免费beta服务。
警告:任何人都可以在您发布此数据后立即读取和更改它…
安装
pip install myjson
用作模块:
>>> import myjson >>> import json >>> url = myjson.store(json.dumps({"test": "ing"})) >>> url 'https://api.myjson.com/bins/ccq2j' >>> json.loads(myjson.get(url))["test"] 'ing' >>> id = myjson.store(json.dumps({"alpha": "beta"}), update=url, id_only=True) >>> print(myjson.get(id)) {"alpha":"beta"} >>> print(myjson.get(url)) {"alpha":"beta"} >>> id 'ccq2j' >>> url 'https://api.myjson.com/bins/ccq2j'
作为脚本
~$ myjson -h usage: myjson [-h] {get,store} ... A python commandline utility for working with https://myjson.com/ positional arguments: {get,store} mjson commands optional arguments: -h, --help show this help message and exit ~$ myjson store example.json https://api.myjson.com/bins/ut5tn ~$ myjson get ut5n --compact [1,2,3]