summaryrefslogtreecommitdiff
path: root/examples/http_over_xmpp.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/http_over_xmpp.py')
-rw-r--r--examples/http_over_xmpp.py34
1 files changed, 15 insertions, 19 deletions
diff --git a/examples/http_over_xmpp.py b/examples/http_over_xmpp.py
index a2fbf664..73e4a612 100644
--- a/examples/http_over_xmpp.py
+++ b/examples/http_over_xmpp.py
@@ -1,17 +1,17 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
- SleekXMPP: The Sleek XMPP Library
+ 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 SleekXMPP.
+ This file is part of slixmpp.
See the file LICENSE for copying permission.
"""
-from sleekxmpp import ClientXMPP
+from slixmpp import ClientXMPP
from optparse import OptionParser
import logging
@@ -32,14 +32,14 @@ class HTTPOverXMPPClient(ClientXMPP):
pass
def http_response_received(self, iq):
- print 'HTTP Response Received : ', iq
- print 'From : ', iq['from']
- print 'To : ', iq['to']
- print 'Type : ', iq['type']
- print 'Headers : ', iq['resp']['headers']
- print 'Code : ', iq['resp']['code']
- print 'Message : ', iq['resp']['message']
- print 'Data : ', iq['resp']['data']
+ print('HTTP Response Received : %s' % iq)
+ print('From : %s' % iq['from'])
+ print('To : %s' % iq['to'])
+ print('Type : %s' % iq['type'])
+ print('Headers : %s' % iq['resp']['headers'])
+ print('Code : %s' % iq['resp']['code'])
+ print('Message : %s' % iq['resp']['message'])
+ print('Data : %s' % iq['resp']['data'])
def session_start(self, event):
# TODO: Fill in the blanks
@@ -87,15 +87,11 @@ if __name__ == '__main__':
format='%(levelname)-8s %(message)s')
if opts.jid is None:
- opts.jid = raw_input('Username: ')
+ opts.jid = input('Username: ')
if opts.password is None:
opts.password = getpass.getpass('Password: ')
xmpp = HTTPOverXMPPClient(opts.jid, opts.password)
- if xmpp.connect((opts.ipaddr, int(opts.port))):
- print 'Connected!'
- xmpp.process(block=True)
- else:
- print 'Not connected!'
- print 'Goodbye....'
+ xmpp.connect()
+ xmpp.process()