當前位置: 首頁>>代碼示例>>Python>>正文


Python InternetArchiveCommon.make_pdf_request方法代碼示例

本文整理匯總了Python中InternetArchiveCommon.make_pdf_request方法的典型用法代碼示例。如果您正苦於以下問題:Python InternetArchiveCommon.make_pdf_request方法的具體用法?Python InternetArchiveCommon.make_pdf_request怎麽用?Python InternetArchiveCommon.make_pdf_request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在InternetArchiveCommon的用法示例。


在下文中一共展示了InternetArchiveCommon.make_pdf_request方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: upload_document

# 需要導入模塊: import InternetArchiveCommon [as 別名]
# 或者: from InternetArchiveCommon import make_pdf_request [as 別名]
def upload_document(pdfbits, court, casenum, docnum, subdocnum):
    logger.info('   Uploading document %s.%s.%s.%s' % (court, casenum, docnum, subdocnum))
    request = IACommon.make_pdf_request(pdfbits, court, casenum,
                                        docnum, subdocnum, metadict = {},
                                        makenew=True)
    success, msg = _post_request(request)
    if not success:
        logger.error('   Failed to upload document %s.%s.%s.%s' % (court, casenum, docnum, subdocnum))
        return False, msg
    logger.info('  Uploaded document %s.%s.%s.%s' % (court, casenum, docnum, subdocnum))
    return success, msg
開發者ID:freelawproject,項目名稱:recap-server,代碼行數:13,代碼來源:ia_uploader.py

示例2: put_file

# 需要導入模塊: import InternetArchiveCommon [as 別名]
# 或者: from InternetArchiveCommon import make_pdf_request [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

示例3: put_pdf

# 需要導入模塊: import InternetArchiveCommon [as 別名]
# 或者: from InternetArchiveCommon import make_pdf_request [as 別名]
def put_pdf(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)

    return _dispatch_direct_put(request)
開發者ID:freelawproject,項目名稱:recap-server,代碼行數:8,代碼來源:InternetArchiveDirect.py


注:本文中的InternetArchiveCommon.make_pdf_request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。