sregistry/main/google_drive/__init__.py
def _get_service(self, version='v3'):
        '''get service client for the google drive API
        :param version: version to use (default is v3)
        '''
        invalid = True

        # The user hasn't disabled cache of credentials
        if self._credential_cache is not None:
            storage = Storage(self._credential_cache)

            # The store has never been used before
            if os.path.exists(self._credential_cache):
                credentials = storage.get()
                if not credentials.invalid:
                    invalid = False

        # If credentials are allowed but invalid, refresh
        if invalid is True:
            
            class flags:
                auth_host_name='localhost'
                auth_host_port=[8080]
                noauth_local_webserver=False
                logging_level='INFO'
            flow = oclient.flow_from_clientsecrets(self._secrets, self._scope)
            credentials = tools.run_flow(flow, storage, flags)

            # If the user is ok to cache them
            if self._credential_cache is not None:
                storage.put(credentials)

        # Either way, authenticate the user with credentials
        http = credentials.authorize(httplib2.Http())
        return build('drive', version, http=http)
def _get_service(self, version='v3'):
        '''get service client for the google drive API
        :param version: version to use (default is v3)
        '''
        invalid = True

        # The user hasn't disabled cache of credentials
        if self._credential_cache is not None:
            storage = Storage(self._credential_cache)

            # The store has never been used before
            if os.path.exists(self._credential_cache):
                credentials = storage.get()
                if not credentials.invalid:
                    invalid = False

        # If credentials are allowed but invalid, refresh
        if invalid is True:
            
            class flags:
                auth_host_name='localhost'
                auth_host_port=[8080]
                noauth_local_webserver=False
                logging_level='INFO'
            flow = oclient.flow_from_clientsecrets(self._secrets, self._scope)
            credentials = tools.run_flow(flow, storage, flags)

            # If the user is ok to cache them
            if self._credential_cache is not None:
                storage.put(credentials)

        # Either way, authenticate the user with credentials
        http = credentials.authorize(httplib2.Http())
        return build('drive', version, http=http)
get service client for the google drive API
        :param version: version to use (default is v3)