XEP 0332

1.6 Documentation

«  XEP 0319   ::   Contents   ::   XEP 0333  »

XEP 0332

class slixmpp.plugins.xep_0332.XEP_0332(xmpp, config=None)[source]

XEP-0332: HTTP over XMPP transport

default_config = {'supported_headers': {'Accept', 'Accept-Charset', 'Accept-Encoding', 'Content-Encoding', 'Content-ID', 'Content-Language', 'Content-Length', 'Content-Location', 'Content-Transfer-Encoding', 'Content-Type', 'Date', 'DateTime', 'Description', 'Distribute', 'ETag', 'Error-Info', 'Expect', 'Expires', 'Host', 'Identifier', 'Location', 'Proxy-Authenticate', 'Proxy-Authorization', 'Server', 'Timestamp', 'Transfer-Encoding', 'User-Agent', 'WWW-Authenticate'}}

TODO: Do we really need to mention the supported_headers?!

dependencies = {'xep_0030', 'xep_0131'}

xep_0047 not included. xep_0001, 0137 and 0166 are missing

Stanza elements

Slixmpp: The Slick XMPP Library Implementation of HTTP over XMPP transport http://xmpp.org/extensions/xep-0332.html Copyright (C) 2015 Riptide IO, sangeeth@riptideio.com This file is part of slixmpp.

See the file LICENSE for copying permission.

class slixmpp.plugins.xep_0332.stanza.data.HTTPData(xml=None, parent=None)[source]

The data element.

get_data(encoding='text')[source]
interfaces = {'data'}
is_extension = True
name = 'data'
namespace = 'urn:xmpp:http'
plugin_attrib = 'data'
set_data(data, encoding='text')[source]

slixmpp: The Slick XMPP Library Implementation of HTTP over XMPP transport http://xmpp.org/extensions/xep-0332.html Copyright (C) 2015 Riptide IO, sangeeth@riptideio.com This file is part of slixmpp.

See the file LICENSE for copying permission.

class slixmpp.plugins.xep_0332.stanza.request.HTTPRequest(xml=None, parent=None)[source]

All HTTP communication is done using the Request/Response paradigm. Each HTTP Request is made sending an iq stanza containing a req element to the server. Each iq stanza sent is of type set.

Examples:

<iq type='set' from='a@b.com/browser' to='x@y.com' id='1'>
    <req xmlns='urn:xmpp:http'
         method='GET'
         resource='/api/users'
         version='1.1'>
        <headers xmlns='http://jabber.org/protocol/shim'>
            <header name='Host'>b.com</header>
        </headers>
    </req>
</iq>

<iq type='set' from='a@b.com/browser' to='x@y.com' id='2'>
    <req xmlns='urn:xmpp:http'
         method='PUT'
         resource='/api/users'
         version='1.1'>
        <headers xmlns='http://jabber.org/protocol/shim'>
            <header name='Host'>b.com</header>
            <header name='Content-Type'>text/html</header>
            <header name='Content-Length'>...</header>
        </headers>
        <data>
            <text>...</text>
        </data>
    </req>
</iq>
get_method()[source]
get_resource()[source]
get_version()[source]
interfaces = {'method', 'resource', 'version'}
name = 'request'
namespace = 'urn:xmpp:http'
plugin_attrib = 'http-req'
set_method(method)[source]
set_resource(resource)[source]
set_version(version='1.1')[source]

Slixmpp: The Slick XMPP Library Implementation of HTTP over XMPP transport http://xmpp.org/extensions/xep-0332.html Copyright (C) 2015 Riptide IO, sangeeth@riptideio.com This file is part of slixmpp.

See the file LICENSE for copying permission.

class slixmpp.plugins.xep_0332.stanza.response.HTTPResponse(xml=None, parent=None)[source]

When the HTTP Server responds, it does so by sending an iq stanza response (type=`result`) back to the client containing the resp element. Since response are asynchronous, and since multiple requests may be active at the same time, responses may be returned in a different order than the in which the original requests were made.

Examples:

<iq type='result'
    from='httpserver@clayster.com'
    to='httpclient@clayster.com/browser' id='2'>
    <resp xmlns='urn:xmpp:http'
          version='1.1'
          statusCode='200'
          statusMessage='OK'>
        <headers xmlns='http://jabber.org/protocol/shim'>
            <header name='Date'>Fri, 03 May 2013 16:39:54GMT-4</header>
            <header name='Server'>Clayster</header>
            <header name='Content-Type'>text/turtle</header>
            <header name='Content-Length'>...</header>
            <header name='Connection'>Close</header>
        </headers>
        <data>
            <text>
                ...
            </text>
        </data>
    </resp>
</iq>
get_code()[source]
get_message()[source]
interfaces = {'code', 'message', 'version'}
name = 'response'
namespace = 'urn:xmpp:http'
plugin_attrib = 'http-resp'
set_code(code)[source]
set_message(message)[source]
set_version(version='1.1')[source]

«  XEP 0319   ::   Contents   ::   XEP 0333  »