

def _getActivity(self, serviceRecord, dbcl, path):
    activityData = None
    try:
        (f, metadata) = dbcl.get_file_and_metadata(path)
    except rest.ErrorResponse as e:
        self._raiseDbException(e)
    if (not activityData):
        activityData = f.read()
    try:
        if path.lower().endswith('.tcx'):
            act = TCXIO.Parse(activityData)
        else:
            act = GPXIO.Parse(activityData)
    except ValueError as e:
        raise APIExcludeActivity(('Invalid GPX/TCX ' + str(e)), activity_id=path, user_exception=UserException(UserExceptionType.Corrupt))
    except lxml.etree.XMLSyntaxError as e:
        raise APIExcludeActivity(('LXML parse error ' + str(e)), activity_id=path, user_exception=UserException(UserExceptionType.Corrupt))
    return (act, metadata['rev'])

dataset/ETHPy150Open cpfair/tapiriik/tapiriik/services/Dropbox/dropbox.py DropboxService._getActivity/original