Example #1
0
from . import kafka_producer
from . import Micro
from microservices_connector.Interservices import Microservice
app = Microservice('Flask_app').app
import json
print("adfasdf")
# @Micro.typing('/listen-producer')
# @Micro.json
# @app.route('/listen-producer', methods=['POST'])
# def listen_producer():
#     data = '{"accountNo": "0001001128", "balance": 11951366807, "receivingCash": 0, "debt": 0, "debtInt": 0, "advancedCash": 0}'
#     print("listen_producer: "+data)
#     kafka_producer.run(data)
#     return jsonify({"msg": "Successfully logged out"})
    
Example #2
0
import requests
from microservices_connector.Interservices import Microservice, SanicApp, timeit, Friend
from configparser import ConfigParser
import click
import os
import datetime
from ..initdb import Base, engine, db_session

# enviroment = 'ENV'

# import config from file
config = ConfigParser()
config.read('config.env')

Micro = Microservice(__name__)


@Micro.app.route('/')
def helloworld():
    return 'Hello World'


def init_db():
    """Initiate all database. This should be use one time only
    """
    # import all modules here that might define models so that
    # they will be registered properly on the metadata.  Otherwise
    # you will have to import them first before calling init_db()
    from . import models
    Base.metadata.create_all(bind=engine)
Example #3
0
from microservices_connector.Interservices import Microservice

M = Microservice(__name__)


@M.typing('/helloworld')
@M.reply
def helloworld(name):
    return 'Welcome %s' % (name)


if __name__ == '__main__':
    M.run()