def put_file(self, filename, index, doc_type, id=None, name=None):
if id is None:<EOL><INDENT>request_method = '<STR_LIT:POST>'<EOL><DEDENT>else:<EOL><INDENT>request_method = '<STR_LIT>'<EOL><DEDENT>path = make_path(index, doc_type, id)<EOL>doc = file_to_attachment(filename)<EOL>if name:<EOL><INDENT>doc["<STR_LIT>"] = name<EOL><DEDENT>return self._send_request(request_method, path, doc)<EOL>
Store a file in a index