Viewing File: /opt/alt/python35/lib/python3.5/site-packages/urllib3/util/__pycache__/response.cpython-35.pyc



âì‚Vuã@sXddlmZddlmZddlmZdd„Zdd„Zd	d
„Z	dS)é)Úabsolute_importé)Úhttp_client)ÚHeaderParsingErrorcCsVy|jSWntk
rYnXy|jdkSWntk
rEYnXtdƒ‚dS)zt
    Checks whether a given file-like object is closed.

    :param obj:
        The file-like object to check.
    Nz)Unable to determine whether fp is closed.)ÚclosedÚAttributeErrorÚfpÚ
ValueError)Úobj©rú/response.pyÚis_fp_closeds

r
cCs‹t|tjƒs-tdjt|ƒƒƒ‚t|ddƒ}t|ddƒ}d}|rf|ƒ}|sr|r‡td|d|ƒ‚dS)aP
    Asserts whether all headers have been successfully parsed.
    Extracts encountered errors from the result of parsing headers.

    Only works on Python 3.

    :param headers: Headers to verify.
    :type headers: `httplib.HTTPMessage`.

    :raises urllib3.exceptions.HeaderParsingError:
        If parsing errors are found.
    z"expected httplib.Message, got {0}.ÚdefectsNÚget_payloadÚ
unparsed_data)Ú
isinstanceÚhttplibZHTTPMessageÚ	TypeErrorÚformatÚtypeÚgetattrr)ZheadersrrrrrrÚassert_header_parsings		rcCs2|j}t|tƒr"|dkS|jƒdkS)z°
    Checks whether the request of a response has been a HEAD-request.
    Handles the quirks of AppEngine.

    :param conn:
    :type conn: :class:`httplib.HTTPResponse`
    éZHEAD)Ú_methodrÚintÚupper)ÚresponseÚmethodrrrÚis_response_to_head>s		
rN)
Z
__future__rZpackages.six.movesrrÚ
exceptionsrr
rrrrrrÚ<module>s

Back to Directory File Manager