MyEMS API Service


Providing REST API service for MyEMS Web APP, Android APP and iOS APPand/or third parties




  • Install anytree:

    $ cd ~/tools
    $ git clone
    $ cd anytree
    $ sudo python3 install
  • Install simplejson:

    $ cd ~/tools
    $ git clone
    $ cd simplejson
    $ sudo python3 install
  • Install MySQL Connector:

    $ cd ~/tools
    $ wget wget
    $ tar xzf mysql-connector-python-8.0.28.tar.gz
    $ cd ~/tools/mysql-connector-python-8.0.28
    $ sudo python3 install
  • Install Falcon

    $ mkdir ~/tools/falcon && cd ~/tools/falcon
    $ pip3 download cython falcon falcon-cors falcon-multipart
    $ export LC_ALL="en_US.UTF-8"
    $ export LC_CTYPE="en_US.UTF-8"
    $ sudo dpkg-reconfigure locales
    $ sudo pip3 install --upgrade --no-index --find-links ~/tools/falcon cython falcon falcon-cors falcon-multipart
  • Install gunicorn, refer to

    $ mkdir ~/tools/gunicorn && cd ~/tools/gunicorn
    $ pip3 download gunicorn
    $ sudo pip3 install --no-index --find-links ~/tools/gunicorn gunicorn
  • Install openpyxl, refer to

    Get the latest version of et_xmlfile from
    Get the latest version of jdcal from
    Get the latest version of openpyxl from
    $ cd ~/tools
    $ wget
    $ tar xzf et_xmlfile-1.1.tar.gz
    $ cd ~/tools/et_xmlfile-1.1
    $ sudo python3 install
    $ cd ~/tools
    $ git clone
    $ cd ~/tools/jdcal
    $ sudo python3 install
    $ mkdir ~/tools/pillow && cd ~/tools/pillow
    $ pip3 download Pillow
    $ sudo pip3 install --no-index --find-links ~/tools/pillow Pillow
    $ cd ~/tools
    $ wget
    $ tar xzf openpyxl-3.0.7.tar.gz
    $ cd openpyxl-3.0.7
    $ sudo python3 install
  • Install gunicorn service for myems-api:

    $ cd ~/myems-api
    $ sudo cp -R ~/myems-api /myems-api

    Check and change the config file if necessary:

    $ sudo nano /myems-api/

    Change the listening port (8000 as an example) in gunicorn.socket:

    $ sudo nano /myems-api/gunicorn.socket
    $ sudo ufw allow 8000

    Setup systemd configure files:

    $ sudo cp /myems-api/gunicorn.service /lib/systemd/system/
    $ sudo cp /myems-api/gunicorn.socket /lib/systemd/system/
    $ sudo cp /myems-api/gunicorn.conf /usr/lib/tmpfiles.d/

    Next enable the services so they autostart at boot:

    $ sudo systemctl enable gunicorn.socket
    $ sudo systemctl enable gunicorn.service

    Start the services:

    $ sudo systemctl start gunicorn.socket
    $ sudo systemctl start gunicorn.service

    Run for debugging and testing:

    $ cd myems-api
    $ sudo gunicorn -b app:api