def queryByPortSensor(portiaConfig, edgeId, port, sensor, last=False, params={ 'from': None, 'to': None, 'order': None, 'precision': 'ms', 'limit': None }):
    """Returns a pandas data frame with the portia select resultset"""

    header = {'Accept': 'text/csv'}

    if last == False:
        endpoint = '/select/device/{0}/port/{1}/sensor/{2}{3}'.format( edgeId, port, sensor, utils.buildGetParams(params) )
    else:
        endpoint = '/select/device/{0}/port/{1}/sensor/{2}/last{3}'.format( edgeId, port, sensor, utils.buildGetParams(params) )

    response = utils.httpGetRequest(portiaConfig, endpoint, header)

    if response.status_code == 200:
        try:

            dimensionSeries = pandas.read_csv( StringIO(response.text), sep=';' )
            if portiaConfig['debug']:
                print( '[portia-debug]: {0} rows'.format( len(dimensionSeries.index) ) )

            return dimensionSeries

        except:
            raise Exception('couldn\'t create pandas data frame')
    else:
        raise Exception('couldn\'t retrieve data')
def queryByPortSensor ( portiaConfig , edgeId , port , sensor , last = False , params = { 'from' : None , 'to' : None , 'order' : None , 'precision' : 'ms' , 'limit' : None } ) : header = { 'Accept' : 'text/csv' } if last == False : endpoint = '/select/device/{0}/port/{1}/sensor/{2}{3}' . format ( edgeId , port , sensor , utils . buildGetParams ( params ) ) else : endpoint = '/select/device/{0}/port/{1}/sensor/{2}/last{3}' . format ( edgeId , port , sensor , utils . buildGetParams ( params ) ) response = utils . httpGetRequest ( portiaConfig , endpoint , header ) if response . status_code == 200 : try : dimensionSeries = pandas . read_csv ( StringIO ( response . text ) , sep = ';' ) if portiaConfig [ 'debug' ] : print ( '[portia-debug]: {0} rows' . format ( len ( dimensionSeries . index ) ) ) return dimensionSeries except : raise Exception ( 'couldn\'t create pandas data frame' ) else : raise Exception ( 'couldn\'t retrieve data' )
Returns a pandas data frame with the portia select resultset