本文整理汇总了Python中sword2.Connection.get_atom_sword_statement方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.get_atom_sword_statement方法的具体用法?Python Connection.get_atom_sword_statement怎么用?Python Connection.get_atom_sword_statement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sword2.Connection
的用法示例。
在下文中一共展示了Connection.get_atom_sword_statement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_24_get_sword_statement
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import get_atom_sword_statement [as 别名]
def test_24_get_sword_statement(self):
conn = Connection("http://localhost:%s/sd-uri" % PORT_NUMBER, user_name="sword", user_pass="sword", download_service_document=True)
e = Entry(title="Foo", id="asidjasidj", dcterms_appendix="blah blah", dcterms_title="foo bar")
deposit_receipt = conn.create(payload = "Multipart_POST_then_update_on_EM_IRI",
metadata_entry = e,
mimetype = "text/plain",
filename = "readme.txt",
packaging = 'http://purl.org/net/sword/package/Binary',
col_iri = conn.sd.workspaces[0][1][0].href,
in_progress=True)
ss_iri = None
for item_dict in deposit_receipt.links['http://purl.org/net/sword/terms/statement']:
if item_dict.has_key('type') and item_dict.get('type', None) == "application/atom+xml;type=feed":
ss_iri = item_dict.get('href')
assert ss_iri != None
ss = conn.get_atom_sword_statement(ss_iri)
assert ss != None
assert ss.resources[0].deposited_by == 'sword'
示例2: test_32_get_atom_statement
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import get_atom_sword_statement [as 别名]
def test_32_get_atom_statement(self):
conn = Connection(SSS_URL, user_name=SSS_UN, user_pass=SSS_PW, on_behalf_of=SSS_OBO)
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)
assert receipt.atom_statement_iri is not None
# get the statement
statement = conn.get_atom_sword_statement(receipt.atom_statement_iri)
assert isinstance(statement, Atom_Sword_Statement)