Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

ablog_api description

Project description

ablog_api

ablog_api is a web server (use Flask) for manage ablog site

Installation

Warning

use Python 3

pip install ablog_api

Or

git clone https://github.com/fraoustin/ablog_api.git
cd ablog_api
python setup.py install

Usage

create a ablog

cd
mkdir blog
cd blog
ablog create
ablog build

for run 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

Configuration

list of parameters

  • ABLOG_HOST (default 0.0.0.0)
  • ABLOG_PORT (default 5000)
  • ABLOG_CONF_DIR (default .)
  • ABLOG_DOCTREES (from conf of ablog if null)
  • ABLOG_SRC_DIR (default ABLOG_CONF_DIR)
  • ABLOG_BUILDER (from conf of ablog if null)
  • ABLOG_WEBSITE (from conf of ablog if null)
  • ABLOG_LEVEL_LOG (default logging.DEBUG)
  • ABLOG_USER_XX OR USERS (default guest/guest)
  • ABLOG_ALLOWED_EXTENSIONS (default [‘txt’, ‘pdf’, ‘png’, ‘jpg’, ‘jpeg’, ‘gif’])

load configuration from 3 ways (in order)

  • from ~/.ablog/conf.py, sample
USERS = [{'id':0, 'username':'tutu','password':'toto'},
         {'id':1, 'username':'tyty','password':'titi'},
        ]
ABLOG_PORT=80
  • from env
export ABLOG_PORT=80
export ABLOG_USER_0='tutu:toto'
export ABLOG_USER_1='tyty:titi'
  • from command line for ABLOG
ablog-api -p 80

Test

Warning

use 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/

with requests module

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')

V. 0.7.1

correction of title

V. 0.7.0

optimize, remove pickle

V. 0.6.2

optimize pickle

V. 0.6.1

add try except change format date

V. 0.6.0

add optimize

V. 0.5.1

correction of python version

V. 0.5.0

add python version

V. 0.4.0

change manage get (by data)

V. 0.3.0

change manage edit (by data)

V. 0.2.0

correction from dev ablog_cli

V. 0.1.0

first version cf readme

V. 0.0.1

  • init

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
ablog_api-0.7.1.tar.gz (29.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page