Exemplo n.º 1
0
def record(host=None,
           http_port=None,
           ssh_port=None,
           record_dir=None,
           auth_type='pass',
           remote_host=None,
           remote_port=22):
    if auth_type == 'pass':
        username = os.environ.get('REMOTE_USER')
        password = os.environ.get('REMOTE_PASS')
        ssh_client = ssh.client.create_using_password(username, password,
                                                      remote_host, remote_port)
    elif auth_type == 'key':
        username = os.environ.get('REMOTE_USER')
        key_path = os.environ.get('REMOTE_KEY_PATH')
        ssh_client = ssh.client.create_using_private_key(
            username, key_path, remote_host, remote_port)
    else:
        raise NotImplementedError

    if not record_dir:
        record_dir = os.path.join(os.path.dirname(__file__), "recordings")
    if not os.path.exists(record_dir):
        os.makedirs(record_dir)

    driver = RecordDriver(ssh_client, record_dir)
    server = SshServer(host, ssh_port, driver)
    server.start()
    api_server = app.create()
    api_server.run(host=host, port=http_port, debug=False)
    server.stop()
    print('Stopped')
Exemplo n.º 2
0
def local(host=None, http_port=None, ssh_port=None):
    driver = LocalDriver()
    server = SshServer(host, ssh_port, driver)
    server.start()
    api_server = app.create()
    api_server.run(host=host, port=http_port, debug=False)
    server.stop()
    print('Stopped')
Exemplo n.º 3
0
import os

os.environ["CSESAPI_DB"]      = os.environ['OPENSHIFT_POSTGRESQL_DB_URL']
os.environ["CSESAPI_DATADIR"] = os.environ['OPENSHIFT_DATA_DIR'] + "/cses"

from api import app as application
application.create()
Exemplo n.º 4
0
def client():
    application = app.create('settings')
    return application.test_client()
Exemplo n.º 5
0
#! /usr/bin/env python3

"""
This script starts a development server.
"""

import _util

import os, sys

bind = sys.argv[1] if len(sys.argv) > 1 else "localhost"

from api import app
app.create()
app.devserver(host=bind)
from api import app

application = app.create('settings_prod')
Exemplo n.º 7
0
#!/usr/bin/env python3
from api import app

application = app.create('settings')
application.run(port=application.config["PORT"])