def cli_get(context, path=None):
path = path.lstrip('<STR_LIT:/>') if path else None<EOL>if not path:<EOL><INDENT>return cli_get_account_listing(context)<EOL><DEDENT>elif '<STR_LIT:/>' not in path.rstrip('<STR_LIT:/>'):<EOL><INDENT>return cli_get_container_listing(context, path)<EOL><DEDENT>status, reason, headers, contents = <NUM_LIT:0>, '<STR_LIT>', {}, '<STR_LIT>'<EOL>with context.client_manager.with_client() as client:<EOL><INDENT>status, reason, headers, contents = client.get_object(<EOL>*path.split('<STR_LIT:/>', <NUM_LIT:1>), headers=context.headers, query=context.query,<EOL>cdn=context.cdn)<EOL>if status // <NUM_LIT:100> != <NUM_LIT:2>:<EOL><INDENT>if status == <NUM_LIT> and context.ignore_404:<EOL><INDENT>return<EOL><DEDENT>if hasattr(contents, '<STR_LIT>'):<EOL><INDENT>contents.read()<EOL><DEDENT>raise ReturnCode(<EOL>'<STR_LIT>' % (path, status, reason))<EOL><DEDENT>if context.decrypt:<EOL><INDENT>crypt_type = contents.read(<NUM_LIT:1>)<EOL>if crypt_type == AES256CBC:<EOL><INDENT>contents = FileLikeIter(aes_decrypt(<EOL>context.decrypt, contents,<EOL>chunk_size=getattr(client, '<STR_LIT>', <NUM_LIT>)))<EOL><DEDENT>else:<EOL><INDENT>raise ReturnCode(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (path, crypt_type))<EOL><DEDENT><DEDENT>def disk_closed_callback(disk_path):<EOL><INDENT>if context.remove_empty_files and not os.path.getsize(disk_path):<EOL><INDENT>os.unlink(disk_path)<EOL>if context.io_manager.stdout_root:<EOL><INDENT>dirname = os.path.dirname(disk_path)<EOL>while dirname and dirname.startswith(<EOL>context.io_manager.stdout_root):<EOL><INDENT>try:<EOL><INDENT>os.rmdir(dirname)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>dirname = os.path.dirname(dirname)<EOL><DEDENT><DEDENT>return<EOL><DEDENT>if (headers.get('<STR_LIT>') in<EOL>['<STR_LIT>', '<STR_LIT>'] and<EOL>headers.get('<STR_LIT>') == '<STR_LIT:0>'):<EOL><INDENT>os.unlink(disk_path)<EOL>os.makedirs(disk_path)<EOL><DEDENT>mtime = <NUM_LIT:0><EOL>if '<STR_LIT>' in headers:<EOL><INDENT>mtime = float(headers['<STR_LIT>'])<EOL><DEDENT>elif '<STR_LIT>' in headers:<EOL><INDENT>mtime = time.mktime(time.strptime(<EOL>headers['<STR_LIT>'], '<STR_LIT>'))<EOL><DEDENT>if mtime:<EOL><INDENT>os.utime(disk_path, (mtime, mtime))<EOL><DEDENT><DEDENT>out_path = path<EOL>if context.suppress_container_name:<EOL><INDENT>out_path = out_path.split('<STR_LIT:/>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL><DEDENT>out_path = context.io_manager.client_path_to_os_path(out_path)<EOL>with context.io_manager.with_stdout(<EOL>out_path, disk_closed_callback=disk_closed_callback) as fp:<EOL><INDENT>if context.output_headers:<EOL><INDENT>context.write_headers(<EOL>fp, headers, context.muted_object_headers)<EOL>fp.write('<STR_LIT:\n>')<EOL><DEDENT>chunk = contents.read(<NUM_LIT>)<EOL>while chunk:<EOL><INDENT>fp.write(chunk)<EOL>chunk = contents.read(<NUM_LIT>)<EOL><DEDENT>fp.flush()<EOL><DEDENT><DEDENT>
Performs a GET on the item (account, container, or object).

See :py:mod:`swiftly.cli.get` for context usage information.

See :py:class:`CLIGet` for more information.