class_docstr: Contains static methods for downloading directories or files from S3.
class_docstr_tok: ["Contains","static","methods","for","downloading","directories","or","files","from","S3","."]
docstr: Static method that returns the contents of a s3 object as bytes.
  
  Args:
      s3_uri (str): An S3 uri that refers to a s3 object.
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed. If not specified, one is created
          using the default AWS configuration chain.
  
  Returns:
      bytes: The body of the file.
docstr_tok: ["Static","method","that","returns","the","contents","of","a","s3","object","as","bytes",".","Args",":","s3_uri","(","str",")",":","An","S3","uri","that","refers","to","a","s3","object",".","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed",".","If","not","specified",",","one","is","created","using","the","default","AWS","configuration","chain",".","Returns",":","bytes",":","The","body","of","the","file","."]
code: def read_bytes(s3_uri, sagemaker_session=None) -> bytes:
      """Static method that returns the contents of a s3 object as bytes.
  
      Args:
          s3_uri (str): An S3 uri that refers to a s3 object.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, one is created
              using the default AWS configuration chain.
  
      Returns:
          bytes: The body of the file.
      """
      sagemaker_session = sagemaker_session or Session()
  
      bucket, object_key = parse_s3_url(s3_uri)
  
      bytes_io = io.BytesIO()
      sagemaker_session.s3_resource.Bucket(bucket).download_fileobj(
          object_key, bytes_io
      )
      bytes_io.seek(0)
      return bytes_io.read()
  
file_path: sagemaker-python-sdk/src/sagemaker/s3.py
imports: from __future__ import print_function, absolute_import
  import logging
  import io
  from typing import Union
  from sagemaker.session import Session
  from sagemaker.s3_utils import parse_s3_url, s3_path_join, determine_bucket_and_prefix
label_desc: Use image node_id 3 for calling the S3Downloader obj's underlying member method code with example usage: obj.read_bytes(s3_uri, sagemaker_session) and returns: bytes_io