本文整理汇总了Python中InternetArchiveCommon.make_dockethtml_request方法的典型用法代码示例。如果您正苦于以下问题:Python InternetArchiveCommon.make_dockethtml_request方法的具体用法?Python InternetArchiveCommon.make_dockethtml_request怎么用?Python InternetArchiveCommon.make_dockethtml_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternetArchiveCommon
的用法示例。
在下文中一共展示了InternetArchiveCommon.make_dockethtml_request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upload_docket
# 需要导入模块: import InternetArchiveCommon [as 别名]
# 或者: from InternetArchiveCommon import make_dockethtml_request [as 别名]
def upload_docket(docket, nonce):
"""Case should be locked prior to this method"""
ia_docket, message = _get_docket_from_IA(docket)
if ia_docket:
docket.merge_docket(ia_docket)
# Don't upload if nothing has changed
if docket == ia_docket:
return True, 'Unmodified'
docket.nonce = nonce
#TK: Check that it's okay to always request a new bucket made
request = IACommon.make_docketxml_request(docket.to_xml(),
docket.get_court(),
docket.get_casenum(),
docket.casemeta,
makenew=True)
success, msg = _post_request(request)
if not success:
logger.error('XML Docket upload for %s.%s failed: %s', docket.get_court(),
docket.get_casenum(),
msg)
return False, msg
logger.info('XML Docket upload for %s.%s succeeded', docket.get_court(),
docket.get_casenum())
# TK: Maybe handle this in a separate function that can deal with html?
# Assuming this is sucessful, also upload an update to the html page
request = IACommon.make_dockethtml_request(docket.to_html(),
docket.get_court(),
docket.get_casenum(),
docket.casemeta)
success, msg = _post_request(request)
if not success:
logger.error('HTML Docket upload for %s.%s failed: %s', docket.get_court(),
docket.get_casenum(),
msg)
return False, msg
logger.info('HTML Docket upload for %s.%s succeeded', docket.get_court(),
docket.get_casenum())
return success, msg
示例2: put_dockethtml
# 需要导入模块: import InternetArchiveCommon [as 别名]
# 或者: from InternetArchiveCommon import make_dockethtml_request [as 别名]
def put_dockethtml(court, casenum, docket):
dockethtml = docket.to_html()
request = IACommon.make_dockethtml_request(dockethtml, court, casenum,
docket.casemeta)
return _dispatch_direct_put(request)