ablog api描述
ablog_api的Python项目详细描述
ablog U接口
ablog api是用于管理ablog site的web服务器(使用Flask)
安装
警告
使用python 3
pip install ablog_api
或
git clone https://github.com/fraoustin/ablog_api.git cd ablog_api python setup.py install
使用量
创建ablog
cd mkdir blog cd blog ablog create ablog build
用于运行ablog_api
cd ablog-api --help Usage: ablog-api [options] args run a api server for ablog Options: --version show program's version number and exit -h, --help show this help message and exit -H HOST, --host=HOST the hostname to listen on -p PORT, --port=PORT the port of the webserver -c CONF, --conf=CONF file configuration -d DIR_ABLOG, --dir=DIR_ABLOG dir of conf ablog -l LEVEL, --log=LEVEL level of log: DEBUG,INFO,WARNING,CRITICAL,ERROR by Frederic Aoustin ablog-api -d ./blog
URL | explain |
---|---|
/api/doc | documentation of Api |
/api/login | log a user in |
/api/logout | logout |
/api/version | get version |
/api/ls | list of posts |
/api/rm | del post |
/api/edit | update post |
/api/build | load ablog build |
/api/clean | load ablog clean |
/api/get | get value of post |
/api/conf | get value of conf |
/api/upload | upload file |
/api/download | download file |
配置
参数列表
- ablogu主机(默认为0.0.0.0)
- ablogu端口(默认5000)
- ABLOG_CONF_DIR(默认设置。)
- ablogu doctrees(如果为空,则来自ablog conf)
- ablog_src_dir(默认ablog_conf_dir)
- ablog_builder(如果为空,则来自ablog的配置)
- ablogu网站(如果为空,则从ablog conf获取)
- ABLOG_LEVEL_日志(默认日志记录。调试)
- ablog_user_xx或用户(默认来宾/来宾)
- 允许的日志扩展名(默认值为“txt”、“pdf”、“png”、“jpg”、“jpeg”、“gif”)
从3个方向(按顺序)加载配置
- 来自~/.ablog/conf.py,示例
USERS = [{'id':0, 'username':'tutu','password':'toto'}, {'id':1, 'username':'tyty','password':'titi'}, ] ABLOG_PORT=80
- 从env
export ABLOG_PORT=80 export ABLOG_USER_0='tutu:toto' export ABLOG_USER_1='tyty:titi'
- 从ablog的命令行
ablog-api -p 80
测试
警告
使用Python 3
git clone https://github.com/fraoustin/ablog_api.git cd ablog_api python setup.py install cd test/blog ablog build cd ../../ python -m unittest discover -s test/
带请求模块
import requests, json r = requests.post('http://127.0.0.1:5000/api/login', data=json.dumps({"username":"guest", "password":"guest"})) r = requests.post('http://127.0.0.1:5000/api/version')
第0.7.1节
所有权更正
0.7.0伏
优化,去除泡菜
第0.6.2节
优化pickle
第0.6.1节
添加try except 更改格式日期
0.6.0伏
添加优化
第0.5.1节
python版本的修正
0.5.0伏
添加Python版本
0.4.0伏
更改管理获取(按数据)
0.3.0伏
更改管理编辑(按数据)
0.2.0版
dev ablog_cli的更正
0.1.0伏
第一版cf自述
0.0.1伏
- 初始