Created
July 31, 2013 00:16
-
-
Save lgawin/6118253 to your computer and use it in GitHub Desktop.
Sample code for xmpp client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Jul 31, 2013 | |
@author: gawcio | |
''' | |
import sys, json, xmpp, random, string | |
SERVER = 'gcm.googleapis.com' | |
PORT = 5235 | |
USERNAME = {%SenderId/ProjectId%} | |
PASSWORD = {%API KEY%} | |
REGISTRATION_ID = '' | |
client = xmpp.Client('gcm.googleapis.com', debug=['socket']) | |
client.connect(server=(SERVER,PORT), secure=1, use_srv=False) | |
auth = client.auth(USERNAME, PASSWORD) | |
if not auth: | |
print 'Authentication failed!' | |
sys.exit(1) | |
if __name__ == '__main__': | |
pass | |
''' | |
Invalid debugflag given: socket | |
DEBUG: | |
DEBUG: Debug created for /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xmpp/client.py | |
DEBUG: flags defined: socket | |
DEBUG: socket start Plugging <xmpp.transports.TCPsocket instance at 0x100721098> into <xmpp.client.Client instance at 0x100704cb0> | |
DEBUG: socket start Successfully connected to remote host ('gcm.googleapis.com', 5235) | |
DEBUG: socket sent <?xml version='1.0'?> | |
<stream:stream xmlns="jabber:client" to="gcm.googleapis.com" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" > | |
DEBUG: socket warn SSL_WANT_READ while receiving data, asking for a retry | |
DEBUG: socket got <stream:stream from="gcm.googleapis.com" id="7BB4EB69E87E9AD6" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"> | |
DEBUG: socket warn SSL_WANT_READ while receiving data, ignoring | |
DEBUG: socket got <stream:features> | |
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> | |
<mechanism>X-OAUTH2</mechanism> | |
<mechanism>X-GOOGLE-TOKEN</mechanism> | |
<mechanism>PLAIN</mechanism> | |
</mechanisms> | |
</stream:features> | |
DEBUG: socket sent <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">MjIzMTM0ODY2NDMwQGdjbS5nb29nbGVhcGlzLmNvbQAyMjMxMzQ4NjY0MzAAQUl6YVN5QUZ1UndkWS0tQ0xxZFdDdkRlbkdwVVZCSWlrN1g4UG1j</auth> | |
DEBUG: socket warn SSL_WANT_READ while receiving data, asking for a retry | |
DEBUG: socket got <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> | |
<temporary-auth-failure/> | |
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Project 223134866430 not whitelisted.</text> | |
</failure> | |
Authentication failed! | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment