コード例 #1
0
def observation_datatypes_v1_0():
    """
    API Format: /api/v1.0/observation/datatypes.json

    Returns the list of observational data types

    **Used in ObservationSelector**
    """
    max_age = 86400
    data = [{
        'id': dt.key,
        'value': dt.name,
    } for dt in ob_queries.get_datatypes(DB.session)]
    resp = jsonify(data)
    resp.cache_control.max_age = max_age
    return resp
コード例 #2
0
 def test_get_datatypes(self):
     result = q.get_datatypes(self.session)
     self.assertEqual(len(result), 15)
     self.assertIsInstance(result[0], DataType)