diff options
author | Sangeeth Saravanaraj <sangeeth@riptideio.com> | 2015-01-28 14:52:15 +0530 |
---|---|---|
committer | Sangeeth Saravanaraj <sangeeth@riptideio.com> | 2015-01-28 14:52:15 +0530 |
commit | e1f25604ecbf5d6c196080cd8394191c7ea459c9 (patch) | |
tree | 8c57cf4dad8f1109e7502f029fd8ad573e5ca9d4 /sleekxmpp/plugins/xep_0332/stanza/request.py | |
parent | 0fe057b5c3f462275cf8dbf321c2ebec61de1bfe (diff) | |
download | slixmpp-e1f25604ecbf5d6c196080cd8394191c7ea459c9.tar.gz slixmpp-e1f25604ecbf5d6c196080cd8394191c7ea459c9.tar.bz2 slixmpp-e1f25604ecbf5d6c196080cd8394191c7ea459c9.tar.xz slixmpp-e1f25604ecbf5d6c196080cd8394191c7ea459c9.zip |
Added callbacks, registered stanzas, added features, etc.
Diffstat (limited to 'sleekxmpp/plugins/xep_0332/stanza/request.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0332/stanza/request.py | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0332/stanza/request.py b/sleekxmpp/plugins/xep_0332/stanza/request.py index 3d75b534..ea2650c0 100644 --- a/sleekxmpp/plugins/xep_0332/stanza/request.py +++ b/sleekxmpp/plugins/xep_0332/stanza/request.py @@ -8,14 +8,42 @@ See the file LICENSE for copying permission. """ -from sleekxmpp import Iq -from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin -from sleekxmpp.plugins.xep_0131.stanza import Headers +from sleekxmpp.xmlstream import ElementBase +from sleekxmpp.plugins.xep_0332.stanza import NAMESPACE class Request(ElementBase): - pass + """ + 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/user' 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><html><header/><body><p>Beautiful home page.</p></body></html></text> + </data> + </req> + </iq> + """ + + name = 'request' + namespace = NAMESPACE + interfaces = set(('method', 'resource', 'version')) + plugin_attrib = 'req' -register_stanza_plugin(Iq, Request) -register_stanza_plugin(Request, Headers) |