本文整理汇总了Python中sword2.Connection.append方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.append方法的具体用法?Python Connection.append怎么用?Python Connection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sword2.Connection
的用法示例。
在下文中一共展示了Connection.append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_30_advanced_add_multipart
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import append [as 别名]
def test_30_advanced_add_multipart(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)
receipt = conn.get_deposit_receipt(receipt.location)
ne = Entry(title="Multipart deposit", id="asidjasidj", dcterms_identifier="http://another/",
dcterms_creator="Me!", dcterms_rights="CC0")
with open(PACKAGE) as pkg:
new_receipt = conn.append(dr=receipt,
metadata_entry=ne,
payload=pkg,
filename="addition.zip",
mimetype=PACKAGE_MIME,
packaging="http://purl.org/net/sword/package/SimpleZip",
in_progress=True,
metadata_relevant=True)
assert new_receipt.code >= 200 and new_receipt.code < 400
示例2: test_18_Metadata_POST_to_se_iri
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import append [as 别名]
def test_18_Metadata_POST_to_se_iri(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)
assert deposit_receipt.se_iri != None
e.add_fields(dcterms_identifier="doi://somerubbish", dcterms_foo="blah blah")
dr = conn.append(se_iri = deposit_receipt.se_iri,
metadata_entry = e,
in_progress=False)
assert dr.code == 200
示例3: test_19_File_POST_to_se_iri
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import append [as 别名]
def test_19_File_POST_to_se_iri(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)
assert deposit_receipt.se_iri != None
dr = conn.append(se_iri = deposit_receipt.se_iri,
payload = "Multipart_POST_then_appending_file_on_SE_IRI -- updated resource",
mimetype = "text/plain",
filename = "readthisextrafile.txt",
packaging = "http://purl.org/net/sword/package/Binary")
assert dr.code == 201
示例4: test_27_basic_add_metadata
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import append [as 别名]
def test_27_basic_add_metadata(self):
conn = Connection(SSS_URL, user_name=SSS_UN, user_pass=SSS_PW)
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)
receipt = conn.get_deposit_receipt(receipt.location)
ne = Entry(title="Multipart deposit", id="asidjasidj", dcterms_identifier="http://another/",
dcterms_creator="Me!", dcterms_rights="CC0")
new_receipt = conn.append(dr=receipt, metadata_entry=ne)
assert new_receipt.code == 200