module lightblue.obex:

class OBEXResponse

    Contains the OBEX response received from an OBEX server.

    When an OBEX client sends a request, the OBEX server sends back a response
    code (to indicate whether the request was successful) and a set of response
    headers (to provide other useful information).

    For example, if a client sends a 'Get' request to retrieve a file, the
    client might get a response like this:
        >>> import lightblue
        >>> client = lightblue.obex.OBEXClient("aa:bb:cc:dd:ee:ff", 10)
        >>> response = client.get({"name": "file.txt"}, file("file.txt", "w"))
        >>> print response
        <OBEXResponse reason='OK' code=0x20 (0xa0) headers={'length': 35288}>
You can get the response code and response headers in different formats:
        >>> print response.reason
        'OK'    # a string description of the response code
        >>> print response.code
        32      # the response code
        >>> print response.headers
        {'length': 35288}   # the headers, with string keys
        >>> print response.rawheaders
        {195: 35288}        # the headers, with raw header ID keys
        >>>
Note how the 'code' attribute does not have the final bit set - e.g. for OK/Success, the response code is 0x20, not 0xA0. The lightblue.obex module defines constants for response code values (e.g. lightblue.obex.OK, lightblue.obex.FORBIDDEN, etc.).

Properties

code

The response code, without the final bit set.

headers

The response headers, as a dictionary with string keys.

rawheaders

The response headers, as a dictionary with header ID (unsigned byte) keys.

reason

A string description of the response code.

Methods

getheader(header, default=None)

        Returns the response header value for the given header, which may
        either be a string (not case-sensitive) or the raw byte
        value of the header ID.

        Returns the specified default value if the header is not present.