本文整理汇总了Python中sword2.Connection.delete_container方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.delete_container方法的具体用法?Python Connection.delete_container怎么用?Python Connection.delete_container使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sword2.Connection
的用法示例。
在下文中一共展示了Connection.delete_container方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_31_delete_container
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import delete_container [as 别名]
def test_31_delete_container(self):
conn = Connection(SSS_URL, user_name=SSS_UN, user_pass=SSS_PW, on_behalf_of=SSS_OBO,
error_response_raises_exceptions=False)
conn.get_service_document()
col = conn.sd.workspaces[0][1][0]
#e = Entry(title="Multipart deposit", id="asidjasidj", dcterms_abstract="abstract", dcterms_identifier="http://whatever/")
with open(PACKAGE) as pkg:
receipt = conn.create(col_iri = col.href,
#metadata_entry = e,
payload=pkg,
mimetype=PACKAGE_MIME,
filename="example.zip",
packaging = 'http://purl.org/net/sword/package/SimpleZip')
# ensure that we have a receipt (the server may not give us one
# by default)
edit_iri = receipt.location
receipt = conn.get_deposit_receipt(edit_iri)
# delete the container
new_receipt = conn.delete_container(dr=receipt)
assert new_receipt.code == 204
assert new_receipt.dom is None
# the next check is that this 404s appropriately now
another_receipt = conn.get_deposit_receipt(edit_iri)