README.md

    = HA(High Available) Python API

    == Introduction

    This project contains the Python Restful API for HA.

    == Important

    Note that most of the code of this SDK is automatically generated. If you just installed the package then you will have everything already, but if you downloaded the source then you will need to generate it, follow the instructions in the README.adoc file of the parent directory.

    == Installation

    The API can be installed in openEuler 20.03 LTS and CentOS-8 using the RPM packages provided by the oVirt project. To do so install the oVirt release package:

    dnf install http://XXXX

    Then install the SDK packages. For Python 2:

    dnf install python3-ha-api

    For Python 3:

    dnf install python3-ha-api

    For other operating systems (and also for Fedora and CentOS) you can install the API using the pip command, which will download the source from https://pypi.python.org/pypi[PyPI], build and install it.

    The API uses http://www.xmlsoft.org[libxml2] for parsing and rendering XML. The part of the SDK that interacts with that library is written in C. This means that before building you must make sure you have the C compiler and the required header and libraries files installed in your system. For example, if you are using distributions like Fedora, or

    CentOS-8 and openEuler:

    dnf -y install \

    gcc
    libxml2-devel
    python-devel
    python-virtualenv

    For Python 3:

    dnf -y install \

    gcc
    libxml2-devel
    python3-devel

    == Usage

    === Packages

    The following are the Python modules that are most frequently needed in order to use the API:

    === How to develop

    pip install flask

    git clone https://gitee.com/openkylin/ha-api --brnach api-flask

    cd ha-api

    === Install Flask Within the activated environment, use the following command to install Flask:

    cd /etc/yum.repos.d/

    wget http://openkylin.com/repo/openkylin.repo

    yum install python3-flask python3-pam

    /usr/bin/msgfmt -o ha-api.mo zh_CN.po

    mkdir -p /usr/share/locale/zh_CN/LC_MESSAGES/

    cp ha-api.mo /usr/share/locale/zh_CN/LC_MESSAGES/

    === Run the app

    python3 run.py

     * Running on https://0.0.0.0:8088/ 

    === Important function

    pytest

    ========================= test session starts ========================== platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 rootdir: /home/user/Projects/flask-tutorial, inifile: setup.cfg collected 23 items

    tests/test_auth.py ........ [ 34%] tests/test_blog.py ............ [ 86%] tests/test_db.py .. [ 95%] tests/test_factory.py .. [100%]

    ====================== 24 passed in 0.64 seconds =======================

    If any tests fail, pytest will show the error that was raised. You can run pytest -v to get a list of each test function rather than dots.

    To measure the code coverage of your tests, use the coverage command to run pytest instead of running it directly.

    coverage run -m pytest

    You can either view a simple coverage report in the terminal:

    coverage report

    Name Stmts Miss Branch BrPart Cover

    flaskr/init.py 21 0 2 0 100% flaskr/auth.py 54 0 22 0 100% flaskr/blog.py 54 0 16 0 100% flaskr/db.py 24 0 4 0 100%

    TOTAL 153 0 44 0 100%

    An HTML report allows you to see which lines were covered in each file:

    coverage html

    This generates files in the htmlcov directory. Open htmlcov/index.html in your browser to see the report.

    项目简介

    API interface for HA management

    发行版本

    当前项目没有发行版本

    贡献者 1

    O openeuler-ci-bot @openeuler-ci-bot

    开发语言