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


Python InternetArchiveCommon.get_pdfname方法代码示例

本文整理汇总了Python中InternetArchiveCommon.get_pdfname方法的典型用法代码示例。如果您正苦于以下问题:Python InternetArchiveCommon.get_pdfname方法的具体用法?Python InternetArchiveCommon.get_pdfname怎么用?Python InternetArchiveCommon.get_pdfname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InternetArchiveCommon的用法示例。


在下文中一共展示了InternetArchiveCommon.get_pdfname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_document_to_blacklist

# 需要导入模块: import InternetArchiveCommon [as 别名]
# 或者: from InternetArchiveCommon import get_pdfname [as 别名]
def add_document_to_blacklist(document):
    BLACKLIST_PATH = "../blacklist"

    f = open(BLACKLIST_PATH, "a")
    f.write(IACommon.get_pdfname(document.court, document.casenum, document.docnum, document.subdocnum) + "\n")
    f.close()
    print "  added document to %s, you may want to add a comment in that file" % BLACKLIST_PATH
开发者ID:ajperrins,项目名称:recap-server,代码行数:9,代码来源:remove_document.py

示例2: put_file

# 需要导入模块: import InternetArchiveCommon [as 别名]
# 或者: from InternetArchiveCommon import get_pdfname [as 别名]
def put_file(filebits, court, casenum, docnum, subdocnum, metadict={}):
    """ PUT the file into a new Internet Archive bucket. """

    request = IACommon.make_pdf_request(filebits, court, casenum,
                                        docnum, subdocnum, metadict)

    # If this file is already scheduled, drop this. # TK: what we want?
    filename = IACommon.get_pdfname(court, casenum, docnum, subdocnum)

    query = PickledPut.objects.filter(filename=filename)
    if query:
        logging.info("put_file: same file already pickled. %s" % filename)
        return "IA PUT failed: the same file is already in the pickle bucket."

    # Add a PickledPut DB entry to schedule the PUT, not yet ready
    ppentry = PickledPut(filename=filename)

    # Fix a race case?
    try:
        ppentry.save()
    except IntegrityError:

        logging.info("put_file: same file already pickled. %s" % filename)
        return "IA PUT failed: the same file is already in the pickle bucket."


    # Pickle the request object into the jar
    pickle_success, message = pickle_object(request, filename)

    if pickle_success:
        # PickledPut now ready for processing.
        ppentry.ready = 1
        ppentry.save()
        logging.info("put_file: ready. %s" % filename)
    else:
        # Could not pickle object, so remove from DB
        logging.warning("put_file: could not pickle PDF. %s" % filename)
        ppentry.delete()

    return message
开发者ID:brianwc,项目名称:recap-server,代码行数:42,代码来源:InternetArchive.py


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