Пример #1
0
    def __init__(self, host, oauth_client=None, headers=None):
        service = get_services()['document_service']
        if host in service:
            self.host = service[host]['url']
        else:
            self.host = host or service['prod']['url']
        L.debug('Using document_service url: %s', self.host)

        self._api = swagger.ApiClient('api_key', self.host)

        #save the oauth_client in case we need to refresh the token (not implemented yet)
        self.oauth_client = oauth_client
        self.headers = headers or {}

        sh.patch_swagger_callapi(self._api, self._get_headers)

        if self.oauth_client:
            self.headers['Authorization'] = self.oauth_client.get_auth_header()
        self.headers['User-Agent'] = 'py_document_service_client'

        #api accessors
        self._project = ProjectApi.ProjectApi(self._api)
        self._project.update = ProjectApi.ProjectApi.update_project
        self._folder = FolderApi.FolderApi(self._api)
        self._folder.update = FolderApi.FolderApi.update_folder
        self._file = FileApi.FileApi(self._api)
        self._file.update = FileApi.FileApi.update_file
        self._entity = EntityApi.EntityApi(self._api)
Пример #2
0
    def __init__(self, host, oauth_client=None, headers=None):
        service = get_services()['document_service']
        if host in service:
            self.host = service[host]['url']
        else:
            self.host = host or service['prod']['url']
        L.debug('Using document_service url: %s', self.host)

        self._api = swagger.ApiClient('api_key', self.host)

        #save the oauth_client in case we need to refresh the token (not implemented yet)
        self.oauth_client = oauth_client
        self.headers = headers or {}

        sh.patch_swagger_callapi(self._api, self._get_headers)

        if self.oauth_client:
            self.headers['Authorization'] = self.oauth_client.get_auth_header()
        self.headers['User-Agent'] = 'py_document_service_client'

        #api accessors
        self._project = ProjectApi.ProjectApi(self._api)
        self._project.update = ProjectApi.ProjectApi.update_project
        self._folder = FolderApi.FolderApi(self._api)
        self._folder.update = FolderApi.FolderApi.update_folder
        self._file = FileApi.FileApi(self._api)
        self._file.update = FileApi.FileApi.update_file
        self._entity = EntityApi.EntityApi(self._api)
Пример #3
0
    def __init__(self, host, oauth_client=None, headers=None):
        '''
        Args:
           host: the protocol and name, 'http://localhost:port
           oauth_client: instance of the bbp_client.oidc.client
           headers: HTTP headers passed to server
        '''
        #mangle server and port
        self.host = host
        self.oauth_client = oauth_client
        self.headers = headers or {}

        if self.oauth_client:
            self.headers['Authorization'] = self.oauth_client.get_auth_header()
        self.headers['User-Agent'] = 'py_task_service_client'

        self._api = swagger.ApiClient('api_key', host)
        sh.patch_swagger_callapi(self._api, self._get_headers)

        self._task_api = TaskApi.TaskApi(self._api)
        self._job_api = JobApi.JobApi(self._api)
Пример #4
0
    def __init__(self, host, oauth_client=None, headers=None):
        '''
        Args:
           host: the protocol and name, 'http://localhost:port
           oauth_client: instance of the bbp_client.oidc.client
           headers: HTTP headers passed to server
        '''
        #mangle server and port
        self.host = host
        self.oauth_client = oauth_client
        self.headers = headers or {}

        if self.oauth_client:
            self.headers['Authorization'] = self.oauth_client.get_auth_header()
        self.headers['User-Agent'] = 'py_task_service_client'

        self._api = swagger.ApiClient('api_key', host)
        sh.patch_swagger_callapi(self._api, self._get_headers)

        self._task_api = TaskApi.TaskApi(self._api)
        self._job_api = JobApi.JobApi(self._api)