def remote_file(self, branch='master', filename=''):
        """Read the remote file on Git Server.

        Args:
            branch (str): Git Branch to find file.
            filename (str): Name of file to retrieve relative to root of
                repository.

        Returns:
            str: Contents of remote file.

        Raises:
            FileNotFoundError: Requested file missing.

        """
        LOG.info('Retrieving "%s" from "%s".', filename, self.git_short)

        file_contents = ''

        try:
            file_blob = self.project.files.get(file_path=filename, ref=branch)
        except gitlab.exceptions.GitlabGetError:
            file_blob = None

        LOG.debug('GitLab file response:\n%s', file_blob)

        if not file_blob:
            msg = 'Project "{0}" is missing file "{1}" in "{2}" branch.'.format(self.git_short, filename, branch)
            LOG.warning(msg)
            raise FileNotFoundError(msg)
        else:
            file_contents = b64decode(file_blob.content).decode()

        LOG.debug('Remote file contents:\n%s', file_contents)
        return file_contents
def remote_file ( self , branch = 'master' , filename = '' ) : LOG . info ( 'Retrieving "%s" from "%s".' , filename , self . git_short ) file_contents = '' try : file_blob = self . project . files . get ( file_path = filename , ref = branch ) except gitlab . exceptions . GitlabGetError : file_blob = None LOG . debug ( 'GitLab file response:\n%s' , file_blob ) if not file_blob : msg = 'Project "{0}" is missing file "{1}" in "{2}" branch.' . format ( self . git_short , filename , branch ) LOG . warning ( msg ) raise FileNotFoundError ( msg ) else : file_contents = b64decode ( file_blob . content ) . decode ( ) LOG . debug ( 'Remote file contents:\n%s' , file_contents ) return file_contents
Read the remote file on Git Server.

        Args:
            branch (str): Git Branch to find file.
            filename (str): Name of file to retrieve relative to root of
                repository.

        Returns:
            str: Contents of remote file.

        Raises:
            FileNotFoundError: Requested file missing.