def put_object(self, cont, obj, local_file):
        try:
            with salt.utils.fopen(local_file, 'rb') as fp_:
                self.conn.put_object(cont, obj, fp_)
            return True
        except Exception as exc:
            log.error('There was an error::')
            if hasattr(exc, 'code') and hasattr(exc, 'msg'):
                log.error('    Code: {0}: {1}'.format(exc.code, exc.msg))
            log.error('    Content: \n{0}'.format(getattr(exc, 'read', lambda: str(exc))()))
            return False
Upload a file to Swift
dataset/ETHPy150Open saltstack/salt/salt/utils/openstack/swift.py/SaltSwift.put_object