예제 #1
0
def start_api(account_id: str, iroha_host, private_key):
    """Starts REST API"""
    if not account_id:
        account_id = click.prompt(
            "Please enter the API AccountID e.g. admin@test")
    if not private_key:
        try:
            script_dir = os.path.dirname(__file__)
            rel_path = f"{account_id}.priv"
            private_key_file = os.path.join(script_dir, rel_path)
            private_key = open(private_key_file, "rb+").read()
            os.environ["IROHA_DB_API_SECRET"] = private_key
        except FileNotFoundError:
            _print("[bold red]Private key file not found[/bold red]")
            sys.exit()
    os.environ["IROHA_HOST"] = iroha_host
    app.run()
예제 #2
0
from os import getenv
from project.server import app

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=getenv('PORT', 8080))
예제 #3
0
from project.server import app

if __name__ == "__main__":
    app.run()
예제 #4
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from project.server import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
예제 #5
0

def generate_recall_json(uid):
    recall_1 = {"uid": uid, "form_X": template_dir + template_X}

    return recall_1


def json_decoder(obj):
    if '__type__' in obj and obj['__type__'] == 'fileinfo':
        return FileInfo(obj['file'], obj['stage'])
    elif '__type__' in obj and obj['__type__'] == 'newuser':
        uid = generate_uid()
        return UserInfo(uid, obj['user_name'], obj['user_pass'], obj['name'],
                        obj['user_type'], obj['email'])
    elif '__type__' in obj and obj['__type__'] == 'userinfo':
        return UserInfo(obj['uid'], obj['user_name'], obj['user_pass'],
                        obj['name'], obj['user_type'], obj['email'])
    return obj


# TODO: what are these

# 3
# app.db = mongo.develop_database
# 4
# api = Api(app)

if __name__ == '__main__':
    app.run(debug=True)
예제 #6
0
# migrations
notifier.add_command('db', MigrateCommand)

@notifier.command
def create_db():
    """Creates the db tables."""
    db.create_all()


@notifier.command
def drop_db():
    """Drops the db tables."""
    db.drop_all()


@notifier.command
def create_admin():
    """Creates the admin user."""
    db.session.add(User(email='*****@*****.**', password='******', admin=True))
    db.session.commit()


@notifier.command
def create_data():
    """Creates sample data."""
    pass


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)
예제 #7
0
파일: manage.py 프로젝트: iPoe/RestMenuAPI
def run_app():
    app.run(debug=True)
예제 #8
0
    except ValueError:
        amount = 200.
        start = ''
        end = ''
    connections = cg.generate(amount, countries)
    f, predecessors, distance = pf.compute(connections)
    g = gr.single(start, end, predecessors, f)
    nodes = g.nodes()
    relabel = {k: v for k, v in name_dict.items() if k in nodes}
    g = nx.relabel_nodes(g, relabel, True)
    labels = nx.get_edge_attributes(g, 'weight')
    newlabels = {k: amount * (1 - np.exp(-v)) for k, v in labels.items()}
    for s in g:
        for f in g:
            if f in g[s]:
                if g[s][f]['weight'] == float('inf'):
                    g.remove_edge(s, f)
                else:
                    g[s][f]['weight'] = amount * (1 -
                                                  np.exp(-g[s][f]['weight']))
            else:
                continue
    resp = Response(response=json.dumps(jg.node_link_data(g)),
      status=200, \
      mimetype="application/json")
    return (resp)


if __name__ == "__main__":
    app.run(debug=True)  # Auto-update server in test/dev environment
예제 #9
0
from project.server import app
from project.utils import proxy

if __name__ == '__main__':
    app.register_blueprint(proxy, url_prefix="/salida")
    app.run(port=8000)