コード例 #1
0
def application_generator():
    print('hello')
    req_data = request.get_json()
    audience = req_data['audience']
    topic = req_data['topic']
    date = req_data["date"]
    time = req_data["time"]
    venue = req_data['venue']
    print(audience, topic, date, time, venue)
    application.create(audience, topic, date, time, venue)
    return "DONE"
コード例 #2
0
def server(skill_id, username, password, port, chrome, debug, skill_schema):
    global continente

    logger = logging.getLogger()
    logger.addHandler(logging.StreamHandler(sys.stderr))

    if debug:
	logging.basicConfig(level=logging.DEBUG)
	logging.getLogger('selenium.webdriver.remote.remote_connection').setLevel(logging.WARNING)
	logging.getLogger('flask_ask').setLevel(logging.DEBUG)
	logger.setLevel(logging.DEBUG)

    options = webdriver.ChromeOptions()
    options.add_argument('window-size=1200x600')
    options.add_argument('headless')
    driver = webdriver.Remote(
	chrome, 
	desired_capabilities=options.to_capabilities()
    )

    json_data=open(skill_schema).read()
    data = json.loads(json_data)
    schema = {'id': skill_id, 'languageModel': data['languageModel'] }
    products = {}
    for i, t in enumerate(schema['languageModel']['types']):
	if t['name'] == 'LIST_OF_PRODUCTS':
	    for j, v in enumerate(t['values']):
		products[v['id']] = v['name']['value']

    continente = Continente(username= username, password= password, driver= driver, products= products)
    continente.login_async()

    app = application.create(continente= continente, logger= logger, schema= schema)
    app.run('0.0.0.0', port, debug=False)
コード例 #3
0
ファイル: conftest.py プロジェクト: v-kolesov/markets-demo
def app():
    os.environ['FLASK_ENV'] = 'testing'
    app = application.create()
    # with app.app_context():
    #     db.drop_all()
    #     db.create_all()
    yield app
コード例 #4
0
ファイル: server.py プロジェクト: brunombsilva/alexa-daikin
def server(port, debug):

    logger = logging.getLogger()
    logger.addHandler(logging.StreamHandler(sys.stderr))

    if debug:
	logging.basicConfig(level=logging.DEBUG)
	logging.getLogger('flask_ask').setLevel(logging.DEBUG)
	logger.setLevel(logging.DEBUG)

    app = application.create(logger= logger)
    app.run('0.0.0.0', port, debug=False)
コード例 #5
0
ファイル: conftest.py プロジェクト: wellic/vue-sanic-spa
def app():
    os.environ['POSTGRES_DB'] = 'test'
    yield application.create('test_api')
コード例 #6
0
import os
from sanic.response import json

import application

app = application.create('api')

@app.route("/")
async def test(request):
    return json({"hello": "world"})

if __name__ == "__main__":                
    debug_mode =  os.getenv('API_MODE', '') == 'dev'   

    app.run(
        host='0.0.0.0',
        port=8000,
        debug=debug_mode, 
        access_log=debug_mode
    )
コード例 #7
0
 def test_verifica_existencia(self, builtin, mock_path):
     mock_path.isfile.return_value = True
     application.create("archivo_existente")
     self.assertFalse(builtin.called, "no se puede crear")
コード例 #8
0
 def test_crear_existente(self, builtin_create, mock_path):
     mock_path.isfile.return_value = False
     application.create("name_file")
     builtin_create.assert_called_with("name_file", "w")
コード例 #9
0
ファイル: utils.py プロジェクト: Telichkin/simple_chat
 def create_app(self):
     return application.create(config.TestingConfig)
コード例 #10
0
from application import create

app = create()
if __name__ == "__main__":
    app.run(host='0.0.0.0')
コード例 #11
0
ファイル: manage.py プロジェクト: Telichkin/simple_chat
"""
Usage: 
    manage.py start (--development | --production) [--host=<host>] [--port=<port>]

Examples:
    python manage.py start --production --host=localhost --port=8080
"""
import eventlet
eventlet.monkey_patch()

from docopt import docopt

import config
import application

if __name__ == '__main__':
    arguments = docopt(__doc__)
    if arguments["--development"]:
        app = application.create(config.DevelopmentConfig)
    else:
        app = application.create(config.ProductionConfig)
    app.app_context().push()
    application.db.create_all()

    host = arguments["--host"] if arguments["--host"] else "0.0.0.0"
    port = int(arguments["--port"]) if arguments["--port"] else None
    application.socket_io.run(app, host=host, port=port)
コード例 #12
0
ファイル: test-mock.py プロジェクト: AngelinaRS/python-mock
 def test_not_exist_file_create(self, mock_open, mock_path):
     mock_path.isfile.return_value == False
     application.create("file_name")
     mock_open.assert_called_with("file_name", "w")