当前位置: 首页>>代码示例>>Python>>正文


Python InternetArchiveCommon.make_dockethtml_request方法代码示例

本文整理汇总了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
开发者ID:freelawproject,项目名称:recap-server,代码行数:50,代码来源:ia_uploader.py

示例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)
开发者ID:freelawproject,项目名称:recap-server,代码行数:7,代码来源:InternetArchiveDirect.py


注:本文中的InternetArchiveCommon.make_dockethtml_request方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。