当前位置: 首页>>代码示例>>Python>>正文


Python api.FlaskAPI类代码示例

本文整理汇总了Python中flask.ext.api.FlaskAPI的典型用法代码示例。如果您正苦于以下问题:Python FlaskAPI类的具体用法?Python FlaskAPI怎么用?Python FlaskAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FlaskAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_manager

def create_manager(case_api_client=CaseApi):
    app = FlaskAPI(__name__)
    app.config.from_pyfile('config.py')

    manager = Manager(app)
    app.register_blueprint(helloworld.blueprint)
    app.register_blueprint(deed.blueprint(case_api_client()))

    db.init(app, manager)

    return manager
开发者ID:LandRegistry,项目名称:charges-deed-api,代码行数:11,代码来源:__init__.py

示例2: create_app

def create_app(config_name):
    app = FlaskAPI(__name__)

    app.config.from_object(config[config_name])

    config[config_name].init_app(app)

    db.init_app(app)

    from api.v1 import api as api_blueprint
    app.register_blueprint(api_blueprint, url_prefix='/api/v1')

    return app
开发者ID:andela-ijubril,项目名称:bucketlist-api,代码行数:13,代码来源:__init__.py

示例3: create_manager

def create_manager():
    app = FlaskAPI(__name__)

    app.config.from_pyfile('config.py')

    app.register_blueprint(helloworld.blueprint)
    app.register_blueprint(home.blueprint)
    app.register_blueprint(case.blueprint)
    app.register_blueprint(borrower.blueprint)
    app.register_blueprint(property.blueprint)
    app.register_blueprint(land_registry.blueprint)

    manager = Manager(app)
    db.init(app, manager)

    return manager
开发者ID:LandRegistry,项目名称:charges-case-api,代码行数:16,代码来源:__init__.py

示例4: create_manager

def create_manager(deed_api_client=DeedApi):
    app = FlaskAPI(__name__)
    app.config.from_pyfile('config.py')

    app.register_blueprint(helloworld.blueprint)
    app.register_blueprint(key.blueprint)
    app.register_blueprint(sign.blueprint(deed_api_client()))

    manager = Manager(app)
    db.init(app, manager)

    return manager
开发者ID:LandRegistry,项目名称:charges-scribe,代码行数:12,代码来源:__init__.py

示例5: FlaskAPI

#!/usr/bin/python
#query = 'Fist Fight'
#print(youtubeSearch(query))

from flask.ext.api import FlaskAPI
from flask import jsonify, request
from ytsearch import youtubeSearch


#initialize server
app = FlaskAPI(__name__)


@app.route('/')
def index():
    all_args = request.args.lists()
    query = request.args['q']
    video = youtubeSearch(query)
    return jsonify(video)

app.run('0.0.0.0', 5000)
开发者ID:fizal619,项目名称:youtube-python-api,代码行数:21,代码来源:run.py

示例6: FlaskAPI

from flask.ext.api import FlaskAPI
from flask import request
from flask.ext.cors import CORS
import sys

if "m" not in sys.argv:
    from memorydb.DB import *
else:
    from mongoDB.DB import *

app = FlaskAPI(__name__)
CORS(app)


@app.route("/api/prices", methods=["GET"])
def prices():
    id = request.args.get("id")
    return DB.getprices(id)


@app.route("/api/prices", methods=["POST"])
def upsertprices():
    data = request.data
    DB.upsertprices(data)
    return ""


@app.route("/api/sales", methods=["POST"])
def upsertsales():
    data = request.data
    DB.upsertsales(data)
开发者ID:grimcoder,项目名称:ProduceMarketPython,代码行数:31,代码来源:main.py

示例7: FlaskAPI

import random
import sys
import uuid

from flask import render_template, url_for, abort, send_file
from flask.ext.api import FlaskAPI
from flask.ext.api.decorators import set_renderers
from flask.ext.api.renderers import HTMLRenderer
from helpers.parsers import CoOccurrenceMatrixParser, JsonParser
# Data from external modules
from data import dendrogram
from examples import example_types

app = FlaskAPI(__name__)


@app.route("/data/score-display/")
def data_score_display():
    """
    Missing docstring.
    """
    return send_file("../data/scores/Absalon-fili-mi_Josquin-Des-Prez_file5.mei")


@app.route("/data/pie-chart/")
def data_pie_chart():
    """
    Missing DOCSTRING.
    Please tell me what this function does...
    """
    return [
开发者ID:ELVIS-Project,项目名称:VIS-Ualizer,代码行数:31,代码来源:main.py

示例8: FlaskAPI

__author__ = 'Alec Nunn'

import sqlite3

from flask.ext.api import FlaskAPI
from flask import _app_ctx_stack, stream_with_context, Response
import time
from common import *

app = FlaskAPI(__name__)


def get_db():
    """
    Opens a connection to the database and returns the database as an object

    Don't forget to close the connection when you are finished please and
    thank you
    """
    sqlite_db = sqlite3.connect('test.db')
    sqlite_db.row_factory = sqlite3.Row
    sqlite_db.create_function('inet_ntoa', 1, get_ip)
    sqlite_db.create_function('inet_aton', 1, get_dec)
    return sqlite_db


def stream_query(q, args):
    """
    Queries the DB
    Returns a generator that "streams" the query results.
    Useful for streaming large data-sets.
开发者ID:alecnunn,项目名称:DrWhois,代码行数:31,代码来源:app.py

示例9: FlaskAPI

from flask import request
from flask.ext.api import FlaskAPI
from flask.ext.api.exceptions import ParseError

from marshmallow import ValidationError

import schema
import models


app = FlaskAPI(__name__)
models.db.init_app(app)

app.config.from_object("settings.Config")

app.config["DEFAULT_RENDERERS"] = [
    "flask.ext.api.renderers.JSONRenderer",
    "flask.ext.api.renderers.BrowsableAPIRenderer",
]


@app.route("/query", methods=["GET", "POST"])
def stocks():
    """Simplest possible implementation of this algorithm."""
    s = schema.QuerySetSchema(strict=True)

    try:
        q = s.load(request.data)
    except ValidationError as err:
        raise ParseError(detail="Bad fields: {}".format(err.field_names))
开发者ID:lextoumbourou,项目名称:mr-api,代码行数:30,代码来源:app.py

示例10: Path

from flask.ext.api.renderers import HTMLRenderer
from flask.ext.api.exceptions import APIException
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, login_user, logout_user, current_user, login_required
from flask.ext.wtf import Form

from wtforms import TextField, BooleanField
from wtforms.validators import Required
from sqlalchemy import Column, Integer, String, DateTime, Boolean, desc, ForeignKey
from unipath import Path
import bleach
import filters

TEMPLATE_DIR = Path(__file__).ancestor(1).child("templates")

app = FlaskAPI(__name__, template_folder=TEMPLATE_DIR)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
app.config['SECRET_KEY'] = 'you-will-never-guess'
db = SQLAlchemy(app)

lm = LoginManager()
lm.init_app(app)
lm.login_view = 'login'

filters.init_app(app)


class LoginForm(Form):
    username = TextField('username', validators = [Required()])

开发者ID:Ogreman,项目名称:readinglist,代码行数:29,代码来源:app.py

示例11: FlaskAPI

from flask.ext.api import FlaskAPI
from application.main.controllers import main
from application.admin.controllers import admin

app = FlaskAPI(__name__)

app.register_blueprint(main, url_prefix='/')
app.register_blueprint(admin, url_prefix='/admin')
开发者ID:isaquealves,项目名称:flask-api-application-boilerplate,代码行数:8,代码来源:__init__.py

示例12: FlaskAPI

from flask import Flask, request, render_template
from flask.ext.api import FlaskAPI, status
from flask.ext.cors import CORS


#when we have secret keys and such turn this back on
import config

app = FlaskAPI(__name__)
app.config['SECRET_KEY'] = 'super-secret'
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
# will pull config options from config.py
#app.config.from_object(config)
开发者ID:knuevena,项目名称:americorps-backend,代码行数:14,代码来源:app.py

示例13: FlaskAPI

from flask.ext.api import FlaskAPI  # importa la clase de flaskapi
from conf.config import LocalConfig  # importa la configuracion la clase que se le da
from modules.authentication import authentication, auth
from modules.authors import authors
from modules.enera import enera
from modules import mongo
import os
from flask import Flask, url_for
from flask import Flask, render_template, url_for
from werkzeug.routing import Map, Rule, NotFound, RequestRedirect, BaseConverter
from flask.ext.script import Manager
from flask import Flask, jsonify

application = FlaskAPI(__name__)
# manager = Manager(application)

if 'Hacker' in os.environ:
    application.config.from_object(DevelopConfig)
else:
    application.config.from_object(LocalConfig)

# Blueprint
application.register_blueprint(authentication, url_prefix='/authentication')
application.register_blueprint(authors, url_prefix='/authors')
application.register_blueprint(enera, url_prefix='/enera')

# we are going to start mongo whit this application
mongo.init_app(application)


@application.route('/')
开发者ID:jarm-mcs,项目名称:pruebam,代码行数:31,代码来源:application.py

示例14: FlaskAPI

from flask import request, url_for
from flask.ext.api import FlaskAPI, status, exceptions
import handlers as h
import tournament as tour
import rq
import os
from database import R
app = FlaskAPI(__name__)

# define api:
#    tournament
#       teams
#       session
#           add, remove, stage next games, get ranking
#           teams
#               add, get
#               team_id
#            games
#               add game
#               game
#                   score, teams
#

#   Teams
#        team
#           members
#           id
#           name
#   Games
#       game
#           teams
开发者ID:alchayward,项目名称:bayesian,代码行数:31,代码来源:api.py

示例15: FlaskAPI

from ConfigFiles import *

######################################################################################################
# Global Variables.
######################################################################################################

VM_IMAGES = {} # Stores all the VM images given as input.
PM_ADDRS = {}  # Stores the IPs of all available Physical Machines
VM_RUNNING = {} # Stores all the running VMs.

######################################################################################################
# Flask Application Initializer.
######################################################################################################

app = FlaskAPI(__name__)

######################################################################################################
# Homepage.
######################################################################################################

@app.route("/", methods=['GET'])
def homepage():
    homeString = {}
    homeString["Cloud Orchestration Layer"] = [
        {
            "Author" : "Mohit Jain", 
            "ver" : "1.0", 
            "Options" : 
                {
                    "List VM Types" : "http://localhost:5000/vm/types",
开发者ID:NightFury13,项目名称:CloudOrchestrationLayer,代码行数:30,代码来源:server.py


注:本文中的flask.ext.api.FlaskAPI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。