本文整理匯總了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)