Пример #1
0
    def __init__(self, server_address, token):
        if token is None:
            raise ValueError("Token is None")
        self.server_address = server_address.strip('/')
        if ('http://'
                not in self.server_address) and ('https://'
                                                 not in self.server_address):
            self.server_address = 'http://' + self.server_address

        self.headers = {'x-api-key': token}
        self.context = {}
        self.additional_fields = {}

        self.team = team_api.TeamApi(self)
        self.workspace = workspace_api.WorkspaceApi(self)
        self.project = project_api.ProjectApi(self)
        self.model = neural_network_api.NeuralNetworkApi(self)
        self.task = task_api.TaskApi(self)
        self.dataset = dataset_api.DatasetApi(self)
        self.image = image_api.ImageApi(self)
        self.annotation = annotation_api.AnnotationApi(self)
        self.plugin = plugin_api.PluginApi(self)
        self.agent = agent_api.AgentApi(self)
        self.role = role_api.RoleApi(self)
        self.user = user_api.UserApi(self)
        self.labeling_job = labeling_job_api.LabelingJobApi(self)
Пример #2
0
    def __init__(self,
                 server_address,
                 token,
                 retry_count=None,
                 retry_sleep_sec=None,
                 external_logger=None):
        '''
        :param server_address: str (example: http://192.168.1.69:5555)
        :param token: str
        :param retry_count: int
        :param retry_sleep_sec: int
        :param external_logger: logger class object
        '''
        if token is None:
            raise ValueError("Token is None")
        self.server_address = server_address.strip('/')
        if ('http://'
                not in self.server_address) and ('https://'
                                                 not in self.server_address):
            self.server_address = 'http://' + self.server_address

        if retry_count is None:
            retry_count = int(os.getenv(SUPERVISELY_PUBLIC_API_RETRIES, '20'))
        if retry_sleep_sec is None:
            retry_sleep_sec = int(
                os.getenv(SUPERVISELY_PUBLIC_API_RETRY_SLEEP_SEC, '1'))

        self.headers = {'x-api-key': token}
        task_id = os.getenv(SUPERVISELY_TASK_ID)
        if task_id is not None:
            self.headers['x-task-id'] = task_id
        self.context = {}
        self.additional_fields = {}

        self.team = team_api.TeamApi(self)
        self.workspace = workspace_api.WorkspaceApi(self)
        self.project = project_api.ProjectApi(self)
        self.model = neural_network_api.NeuralNetworkApi(self)
        self.task = task_api.TaskApi(self)
        self.dataset = dataset_api.DatasetApi(self)
        self.image = image_api.ImageApi(self)
        self.annotation = annotation_api.AnnotationApi(self)
        self.plugin = plugin_api.PluginApi(self)
        self.agent = agent_api.AgentApi(self)
        self.role = role_api.RoleApi(self)
        self.user = user_api.UserApi(self)
        self.labeling_job = labeling_job_api.LabelingJobApi(self)
        self.video = video_api.VideoApi(self)
        # self.project_class = project_class_api.ProjectClassApi(self)
        self.object_class = object_class_api.ObjectClassApi(self)
        self.report = report_api.ReportApi(self)
        self.pointcloud = pointcloud_api.PointcloudApi(self)

        self.retry_count = retry_count
        self.retry_sleep_sec = retry_sleep_sec

        self.logger = external_logger or logger
Пример #3
0
    def __init__(self,
                 server_address,
                 token,
                 retry_count=None,
                 retry_sleep_sec=None,
                 external_logger=None):
        if token is None:
            raise ValueError("Token is None")
        self.server_address = server_address.strip('/')
        if ('http://'
                not in self.server_address) and ('https://'
                                                 not in self.server_address):
            self.server_address = 'http://' + self.server_address

        if retry_count is None:
            retry_count = int(os.getenv(SUPERVISELY_PUBLIC_API_RETRIES,
                                        '7000'))
        if retry_sleep_sec is None:
            retry_sleep_sec = int(
                os.getenv(SUPERVISELY_PUBLIC_API_RETRY_SLEEP_SEC, '1'))

        self.headers = {'x-api-key': token}
        task_id = os.getenv(SUPERVISELY_TASK_ID)
        if task_id is not None:
            self.headers['x-task-id'] = task_id
        self.context = {}
        self.additional_fields = {}

        self.team = team_api.TeamApi(self)
        self.workspace = workspace_api.WorkspaceApi(self)
        self.project = project_api.ProjectApi(self)
        self.model = neural_network_api.NeuralNetworkApi(self)
        self.task = task_api.TaskApi(self)
        self.dataset = dataset_api.DatasetApi(self)
        self.image = image_api.ImageApi(self)
        self.annotation = annotation_api.AnnotationApi(self)
        self.plugin = plugin_api.PluginApi(self)
        self.agent = agent_api.AgentApi(self)
        self.role = role_api.RoleApi(self)
        self.user = user_api.UserApi(self)
        self.labeling_job = labeling_job_api.LabelingJobApi(self)

        self.retry_count = retry_count
        self.retry_sleep_sec = retry_sleep_sec

        self.logger = external_logger or logger