Example #1
0
from api import app
import os
if __name__ == '__main__':
    app.debug = True
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port)
    #app.run()
Example #2
0
#!env/bin/python

# Copyright (C) 2015 Jeffrey Meyers
# This program is released under the "MIT License".
# Please see the file COPYING in the source
# distribution of this software for license terms.

from api import app
app.run(debug=True, port=9000)
Example #3
0
from api import app
if __name__=="__main__":
	app.run()
Example #4
0
File: app.py Project: joanfont/laas
def main():
    app.run('0.0.0.0')
Example #5
0
    def get(self):
        response = Movies.all()
        return encode_response(response), 200

class MovieSearchAPI(Resource):

    @cors
    def get(self, query):
        response = Movies.search(query)
        return encode_response(response), 200

class TokenAPI(Resource):

    @cors
    def post(self):
        data = ast.literal_eval(request.data)
        response = Tokens.generate(data['username'], data['password'])
        return encode_response(response), 200

    @cors
    def options(self):
        return 200

api.add_resource(MovieAPI, '/api/{}/movie/<string:movie_slug>/'.format(VERSION))
api.add_resource(MovieListAPI, '/api/{}/movies/'.format(VERSION))
api.add_resource(MovieSearchAPI, '/api/{}/movies/search/<string:query>'.format(VERSION))
api.add_resource(TokenAPI, '/api/{}/login/'.format(VERSION))

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5001)
Example #6
0
def runserver():
    app.run(debug=True, port=5001)
Example #7
0
from api import app

from api.routes.ingredient import ingredient_index, ingredient_category, ingredient_all, ingredient_create
from api.routes.recipe import recipe_index, recipe_all, recipe_create

if __name__ == "__main__":
    app.run(debug=True, use_reloader=False)
Example #8
0
    title = '微博登陆提醒'
    text = '![.](%s)' % url
    push.push(title, text, config.DingTalkWebHookAtPhone)


def main():
    queue = Message(config.Redis, config.RedisKey)
    weibo = Weibo(config.ChromeDriver, callback)
    while True:
        try:
            msg = queue.getMessage()
            if msg is not None:
                msg = msg.decode()
                if msg == 'debug':
                    weibo.debug("debug")
                    continue
                log.info("检测到消息,准备发送")
                weibo.postWeibo(msg)
        except Exception:
            queue.reAddMessage(msg)
            weibo.debug("exception")
            log.error("error: %s", traceback.format_exc())
            weibo.browser.refresh()
        time.sleep(10)


if __name__ == '__main__':
    t = threading.Thread(target=main, args=(), name="main")
    t.start()
    app.run(host="127.0.0.1", port=8060)
from api import app

app.run(host='localhost', port=5002, debug=True)
Example #10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2018-06-19 10:40:10
# @Author  : taihong ([email protected])
# @Link    :
# @Version : $Id$

from api import app

if __name__ == "__main__":
    app.run(debug=True, port=8083, host='0.0.0.0')
Example #11
0
from api import app

if __name__ == '__main__':
    app.run(host='localhost', port=1337, workers=2, debug=True)
Example #12
0
	def schedule_api(self):
		app.run(API_HOST, API_PORT)
Example #13
0
from api import app
from config import get_bases_conf

if __name__ == '__main__':
    conf = get_bases_conf()["server"]
    app.run(host=conf["host"], port=conf["port"], debug=conf["debug"])
Example #14
0
def serve_api():
    clear_pyc()
    from api import app
    app.run()
Example #15
0
from api import app
app.run(host="0.0.0.0")
Example #16
0
import os

from api import app

if __name__ == '__main__':
    app.debug = True
    host = os.environ.get('IP', '0.0.0.0')
    port = int(os.environ.get('PORT', 8080))
    app.run(host=host, port=port)

Example #17
0
#  along with this package; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#  MA  02110-1301  USA
#
#
#  On Debian GNU/Linux systems, the complete text of the GNU General
#  Public License can be found in `/usr/share/common-licenses/GPL-2'.
#
#  Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
#

import importlib
import sys

activate_this = '/usr/share/python/alienvault-api-core/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

sys.path.insert(0, '/usr/share/python')
api = importlib.import_module("alienvault-api")

import argparse
from api import app

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--port', '-p', default=40010, type=int,
        help='port on which to run server')
    args = parser.parse_args()
    app.run(port=args.port,host='0.0.0.0', debug=True)
Example #18
0
from api import app

if __name__ == '__main__':
    # parser = argparse.ArgumentParser()
    # parser.add_argument(
    # 	'-p', '--port',
    # 	type=int,
    # 	default=5431,
    # 	help='Port of serving api')
    # args = parser.parse_args()
    # app.run(host='0.0.0.0', port=args.port)
    app.run(host='0.0.0.0', port=8000)
Example #19
0
def run_prod_server():
    """Run application in production mode"""
    app.run(host='0.0.0.0', port=8080)
Example #20
0
from api import app
from config.config import MACHINE

app.run(host=MACHINE["HOST"], debug=True)
Example #21
0
from api import app
app.run(debug=True, host='0.0.0.0', port=5003, threaded=True)
Example #22
0
def runserver():
    app.run()
#!env/bin/python
# initialize flask app
u"""Starts development server."""
from api import app, init

init()

app.run(debug=app.config['DEBUG'], host=app.config["HOST"],
        port=app.config["PORT"])
Example #24
0
 def run_api(self):
     """启动API接口"""
     app.run()
from api import app as app_api
app_api.run()
Example #26
0
from api import app as application
import routes

if __name__ == '__main__':
    application.run()
from api import app
app.run(debug=True, port=5000, host='0.0.0.0')
#app.run(debug=True,port=5000,use_reloader=False)
Example #28
0
def runserver(host, port):
    app.run(host, port, debug=True)

    # Clear memcached cache on startup
    cache = get_cache()
    cache.invalidate(True)
Example #29
0
"""Usage: run.py [--host=<host>] [--port=<port>] [--debug | --no-debug]

--host=<host>   set the host address or leave it to 0.0.0.0.
--port=<port>   set the port number or leave it to 5100.

"""
from docopt import docopt
arguments = docopt(__doc__, version='0.1dev')

host = arguments['--host']
port = arguments['--port']
debug = not arguments['--no-debug']

from api import app
if not port: port = 5100
if not host: host = '0.0.0.0'

app.run(debug=debug, host=host, port=int(port))

Example #30
0
from api import app
import sys

""" get port number from command line and start api """

if __name__ == '__main__':
    app.run(host='localhost', port=int(sys.argv[1]))
Example #31
0
import os

from api import app


if __name__ == '__main__':
    app.debug = True
    app.secret = 'much secret, very secure'
    host = os.environ.get('IP', '0.0.0.0')
    port = int(os.environ.get('PORT', 8000))
    app.run(host=host, port=port)
Example #32
0
import os
from flask import send_from_directory
from api import app

client = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ui")
output = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".tmp")

# static files served from nginx in production
@app.route('/<path:path>', methods=['GET'])
def static_proxy(path):
    if os.path.isfile(os.path.join(output, path)):
        return send_from_directory(output, path)
    return send_from_directory(client, path)

# home page served from nginx in production
@app.route('/', methods=['GET'])
def default_index():
    return send_from_directory(client, 'index.html')
    
if __name__ == '__main__':
    app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
    # we set reloader to false because we nodemon handles it in development
    app.run(host='0.0.0.0', port=80, debug=True, use_reloader=False)
Example #33
0
from api import app, routes
import os
import sys

port = int(os.environ.get('PORT', 5000))
try:
    app.run(host=sys.argv[1], port=port, debug=True)
except:
    app.run(port=port, debug=True)
Example #34
0
 def api():
     print('API接口开始运行')
     app.run(host=API_HOST, port=API_PORT)
Example #35
0
# -*- coding: utf-8 -*-
#from api import app as application
from api import app
import os

if __name__ == '__main__':
	app.run(host='0.0.0.0')
	
Example #36
0
 def schedule_api(self):
     """
     开启API
     """
     app.run(host=API_HOST, port=API_PORT)
Example #37
0
from api import app

if __name__ == '__main__':
  app.run(port=5000)
Example #38
0
from api import app
app.run(debug=True,host="0.0.0.0",port=5050)
Example #39
0
def run_dev_server():
    """Run application in development mode"""
    app.run(host='127.0.0.1', port=5000, debug=True)
Example #40
0
from api import app
import os
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=os.getenv('PORT', 5000))
Example #41
0
#!flask/bin/python
from api import app
from config import HOST,PORT

if __name__ == '__main__':
    app.run(host=HOST,debug=True)
Example #42
0
class RouterAdopcion(Resource):
    def post(self):
        adopcion = Adopcion(id_duenio=request.form["id_owner"],
                            id_mascota=request.form["id_pet"],
                            fecha=datetime.datetime.now().isoformat())
        persona = Persona.query.get(request.form["id_owner"])
        if (not persona):
            p = Persona(cedula=request.form["id_owner"],
                        nombre=request.form["name"],
                        apellido=request.form["last_name"],
                        fechaNacimiento=request.form["birthday"],
                        tipo="dueño")
            session.add(p)
            session.commit()
        session.add(adopcion)
        session.commit()


api.add_resource(RouterPersona, '/persona/', '/persona/<string:persona_id>')
api.add_resource(RouterDonacion, '/donacion/<string:donacion_id>')
api.add_resource(RouterDonaciones, '/donaciones/')
api.add_resource(RouterVoluntarios, '/voluntarios/')
api.add_resource(RouterPatrocinadores, '/patrocinadores/')
api.add_resource(RouterMascota, '/mascota/', '/mascota/<string:mascota_id>')
api.add_resource(RouterMascotas, '/mascotas/')
api.add_resource(RouterAdopcion, '/adopcion/')

if __name__ == '__main__':
    app.run(debug=True)
Example #43
0
#!/usr/bin/env python
from api import app
app.run(debug = True, host='0.0.0.0')
Example #44
0
from api import app

app.run(port=8080)
Example #45
0
from api import app as application

if __name__ == "__main__":
    application.run()
Example #46
0
from api import app

if __name__ == "__main__":
    app.run(debug=False)
#!/usr/bin/env python
from api import app

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port=5566)
Example #48
0
 def api():
     app.run(host=API_HOST, port=API_PORT)
Example #49
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Dependencies
import os
from api import app

# Start mailWS
if __name__ == '__main__':
    port = int(os.environ.get("PORT", 22792))
    app.run('0.0.0.0', port=port)
Example #50
0
from api import app

if __name__ == '__main__':
    app.run(ssl_context=('adhoc'))
Example #51
0
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

import argparse

from api import app


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('port', type=int, nargs='?', default=50031)
    parser.add_argument('-d', dest='debug', const=True, nargs='?')
    return parser.parse_args()


def apply_args(app, args):
    if not args.debug is None:
        app.debug = args.debug


# standalone mode
if __name__ == '__main__':
    args = parse_args()
    apply_args(app, args)
    app.run(host='0.0.0.0', port=args.port)

Example #52
0
from api import app

# Run the application
app.run(host="0.0.0.0", port=80, debug=True)
Example #53
0
service_conf = os.path.join(work_dir, 'conf/service.conf')
img = os.path.join(work_dir,'web/static/zabbix')
img_url = {"zabbix_img_url":img}


config = util.get_config(service_conf, 'api')
cobbler_config = util.get_config(service_conf, 'cobbler')
zabbix_config = util.get_config(service_conf, 'zabbix')



#将参数追加到app.config字典中,就可以随意调用了
app.config.update(config)
app.config.update(cobbler_config)
app.config.update(img_url)
app.config.update(zabbix_config)
#print app.config


#实例化数据库类,并将实例化的对象导入配置
app.config['cursor'] = db.Cursor(config)
app.config['zabbix'] = zabbix_api.Zabbix(zabbix_config)

########celery实例化加载###########




if __name__ == '__main__':
    app.run(host=config.get('bind', '0.0.0.0'),port=int(config.get('port')), debug=True)
Example #54
0
from api import app

if __name__ == '__main__':
    app.run()
    # or
    # app.run(debug = True)
Example #55
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from api import app

if __name__ == '__main__':

    # Run app.
    app.run(port=5000, debug=True, host='localhost', use_reloader=True)
Example #56
0
 def schedule_api(self):
     """
     开启API
     """
     app.run(API_HOST, API_PORT)
Example #57
0
'''
Name: Dallas Fraser
Date: 2014-07-20
Project: MLSB API
Purpose: To create an application to act as an api for the database
'''
from api import app
if __name__ == "__main__":
    app.run(debug=True)
Example #58
0
from api import app
from flask import render_template


if __name__=="__main__":
    app.run(debug=app.config['DEBUG'])
Example #59
0
from werkzeug.contrib.profiler import ProfilerMiddleware, MergeStream

#must test further. currently it actually hangs with tornado if one task is long running, so must be some config issue
# from tornado.wsgi import WSGIContainer
# from tornado.httpserver import HTTPServer
# from tornado.ioloop import IOLoop

@app.route('/', methods = ['GET'])
def showGeneric():
   return render_template('index.html')


if __name__=='__main__':

   default_test_description =  os.path.join(os.path.dirname(__file__), 'lib/grammars/defaultTestExecutionDescription')
   TestDescriptionParser().parseTestDescriptionFromFile(default_test_description)

   if profilingEnabled:
      #for profiling
      f = open('runtime/profiler.log', 'w')
      stream = MergeStream(sys.stdout, f)
      app.config['PROFILE'] = True
      app.wsgi_app = ProfilerMiddleware(app.wsgi_app, stream=f)
      app.debug = True

   p = SimplePerformanceLogger("./runtime/performance.csv", 'a')
   p.logPerformance(5)

   app.run(centralIP, centralPort, use_reloader=False, threaded=True)

Example #60
0
import os
#from api._01_manual_response_class import app
from api import app
# from api._03_post_method import app
# from api._04_delete_method import app
# from api._05_flask_restful_simple import app


if __name__ == '__main__':
    app.debug = True
    host = os.environ.get('IP', '0.0.0.0')
    port = int(os.environ.get('PORT', 8888))
    app.run(host=host, port=port, use_reloader=False)