Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def get_error(iri, code=None):
    sworderror_l.debug("Attempting to match %s to a known SWORD2 error IRI" % iri)
    if iri in SWORD2ERRORSBYIRI.keys():
        if code != None:
            if code in SWORD2ERRORSBYIRI[iri]['codes']:
                sworderror_l.info("Matched '%s' to a known SWORD2 error IRI, and HTTP response code is one of the IRI's' expected response codes." % iri)
                return SWORD2ERRORSBYIRI[iri]
            else:
                sworderror_l.error("Matched '%s' to a known SWORD2 error IRI, but the HTTP response code is NOT one of the IRI's' expected response codes." % iri)
                ue = SWORD2ERRORSBYNAME["UNKNOWNERROR"].copy()
                ue['IRI'] = iri
                ue['codes'] = [code]
                return ue
        sworderror_l.info("Matched '%s' to a known error IRI." % iri)
        return SWORD2ERRORSBYIRI[iri]
    else:
        sworderror_l.info("Could not match '%s' to a known SWORD2 error IRI." % iri)
        ue = SWORD2ERRORSBYNAME["UNKNOWNERROR"].copy()
        ue['IRI'] = iri
        ue['codes'] = [code]
        return ue
        


src/s/w/sword2-0.1.15.cc7c6a42843d/sword2/error_document.py   sword2(Download)
 
from deposit_receipt import Deposit_Receipt
from server_errors import SWORD2ERRORSBYIRI, get_error
 
class Error_Document(Deposit_Receipt):
        if "href" in self.dom.attrib.keys():
            self.error_href = self.dom.attrib['href']
            self.error_info = get_error(self.error_href, self.code)