示例#1
0
import urllib
import requests

from flask_restx import Resource
from flask import request
import settings
from api.datamodel import RUNNING_SCENARIO
from api.datamodel import STEP_POST, RECORDER_POST
from api.restx import API as api
from service.datamodel import RunningScenarioClass
from service.exception import RecordingException
from service.recorder import RecorderService

NS = api.namespace('recorders', description='Recording sessions management')

PARSER = api.parser()
PARSER.add_argument(
    'time',
    type=int,
    help='POSIX Timestamp (in nanosec) recorder started immediatly \
            before this time',
    default=None,
    location='args')


@NS.route('/environment/<string:env>')
@api.doc(params={'env': 'Environment identifier'})
class Recorder(Resource):
    """Recorder services management class."""

    logger = logging.getLogger(__name__)
示例#2
0
    ),
    "windheading": fields.Nested(
        SENSOR_VALUE,
        required=False,
        description="Last value for wind heading in degrees"
    ),
    "load": fields.Nested(
        SENSOR_VALUE,
        required=False,
        description="Last value for battery load in %"
    )


})

GET_SENSOR_VALUES = API.parser()
GET_SENSOR_VALUES.add_argument(
    "fromOffset",
    type=fields.String(
        description='Offset from now for beging of period',
        example="-6h"
    ),
    required=True,

)
GET_SENSOR_VALUES.add_argument(
    "toOffset",
    type=fields.String(
        description='Offset from now for beging of period',
        example="-1m"
    ),