Returns the contents of a remote file

        :param path: path to the remote file
        :returns: file contents
        :rtype: binary data
        :raises: HTTPResponseError in case an HTTP error status was returned
185434
def get_file_contents(self, path):
        
        path = self._normalize_path(path)
        res = self._session.get(
            self._webdav_url + parse.quote(self._encode_string(path))
        )
        if res.status_code == 200:
            return res.content
        elif res.status_code >= 400:
            raise HTTPResponseError(res)
        return False
1244282
def load_json_file_contents(path: str) -> str:
    
    assert isinstance(path, str)
    content = None

    file_path = os.path.abspath(path)
    content = fileutils.read_text_from_file(file_path)
    json_object = json.loads(content)
    content = json.dumps(json_object, sort_keys=True, indent=4)

    return content
356216
def read_bytes(self, path):
        """"""
        file = staticfiles_storage.open(path)
        content = file.read()
        file.close()
        return content
1350819
def from_url(cls, path):
        
        if os.path.isfile(path):
            with open(path) as fd:
                data = fd.read()
        else:
            try:
                response = urllib.urlopen(path)
                if response.code >= 300:
                    raise RuntimeError('Unable to load repo from %s' % path)

                data = response.read()
                response.close()
            except IOError:
                raise RuntimeError(
                    'Unable to load repo from %s (IO error)' % path
                )

        return cls(json.loads(data), path)
1159154
def getmap(self, path, query=None):
        
        code, data, ctype = self.get(path, query)
        if ctype != 'application/json':
            self.log.error("Expecting JSON from GET of '%s', got '%s'", self.lastpath, ctype)
            raise HttpError(code=400, content_type='text/plain', content='Remote returned invalid content type: '+ctype)
        try:
            result = json.loads(data)
        except Exception as e:                                                                  # pragma: no cover
            self.log.error("Could not load JSON content from GET %r -- %s", self.lastpath, e)
            raise HttpError(code=400, content_type='text/plain', content='Could not load JSON content')
        return result
218809
def send_file(path, opts={})
      if opts[:type] or not response['Content-Type']
        content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'
      end

      if opts[:disposition] == 'attachment' || opts[:filename]
        attachment opts[:filename] || path
      elsif opts[:disposition] == 'inline'
        response['Content-Disposition'] = 'inline'
      end

      last_modified opts[:last_modified] if opts[:last_modified]

      file      = Rack::File.new nil
      file.path = path
      result    = file.serving env
      result[1].each { |k,v| headers[k] ||= v }
      headers['Content-Length'] = result[1]['Content-Length']
      halt opts[:status] || result[0], result[2]
    rescue Errno::ENOENT
      not_found
    end
49341
def fetch_file_contents(remote_path)
      result = backend.file(remote_path)
      if result.exist? && result.file?
        result.content
      else
        nil
      end
    end
728452
def get_github_content(repo,path,auth=None):
	
	request = requests.get(file_url.format(repo=repo, path=path), auth=auth)
	if not request.ok:
		print("There is a problem with the request")
		print(file_url.format(repo=repo, path=path))
		print(request.json())
		exit(1)
	if not request.json()['encoding'] == 'base64':
		raise RuntimeError("Unknown Encoding encountered when fetching {} from repo {}: {}".format(path,repo,request.json()['encoding']))
	return request.json()['content'].decode('base64').decode('utf8')
566412
def read(path):
    
    data = None
    with open(path, 'r') as f:
        data = f.read()
    f.close()
    return data
226698
def http_download(url, target_path):
    
    r = requests.get(url, stream=True)
    with open(target_path, 'wb') as f:
        # shutil.copyfileobj(resp, f)
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)
    return target_path
151452
def _get_reparse_data(path):
    '''
    
    '''
    # ensure paths are using the right slashes
    path = os.path.normpath(path)

    if not _is_reparse_point(path):
        return None

    fileHandle = None
    try:
        fileHandle = win32file.CreateFileW(
            path,
            0x80000000,  # GENERIC_READ
            1,  # share with other readers
            None,  # no inherit, default security descriptor
            3,  # OPEN_EXISTING
            0x00200000 | 0x02000000  # FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS
        )

        reparseData = win32file.DeviceIoControl(
            fileHandle,
            0x900a8,  # FSCTL_GET_REPARSE_POINT
            None,  # in buffer
            16384  # out buffer size (MAXIMUM_REPARSE_DATA_BUFFER_SIZE)
        )

    finally:
        if fileHandle:
            win32file.CloseHandle(fileHandle)

    return reparseData
870067
public String getFileContents(String path) throws Exception {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        Resources.copy(Pages.class.getResource(path), outputStream);
        return new String(outputStream.toByteArray(), "UTF-8");
    }
135318
def _get_file_content(self, path):
        """"""
        with open(path, 'r') as file_:
            content = file_.read()
        return content
1036227
def __deserialize_file(self, response):
        
        fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
        os.close(fd)
        os.remove(path)

        content_disposition = response.getheader("Content-Disposition")
        if content_disposition:
            filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
                                 content_disposition).group(1)
            path = os.path.join(os.path.dirname(path), filename)

        with open(path, "wb") as f:
            f.write(response.data)

        return path
457573
def fetch_file(self, in_path, out_path):
        '''  '''
        vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)

        data = dict(mode='fetch', in_path=in_path)
        data = utils.jsonify(data)
        data = utils.encrypt(self.key, data)
        self.socket.send(data)

        response = self.socket.recv()
        response = utils.decrypt(self.key, response)
        response = utils.parse_json(response)
        response = response['data']
        response = base64.b64decode(response)        

        fh = open(out_path, "w")
        fh.write(response)
        fh.close()
940933
def encoded_content(self, path):
        """"""
        if path in self.__class__.asset_contents:
            return self.__class__.asset_contents[path]
        data = self.read_bytes(path)
        self.__class__.asset_contents[path] = force_text(base64.b64encode(data))
        return self.__class__.asset_contents[path]
1273998
def download_from(self, buff, remote_path):
        
        urn = Urn(remote_path)
        if self.is_dir(urn.path()):
            raise OptionNotValid(name='remote_path', value=remote_path)

        if not self.check(urn.path()):
            raise RemoteResourceNotFound(urn.path())

        response = self.execute_request(action='download', path=urn.quote())
        buff.write(response.content)