问题描述
我试图让我找到的Python代码正常工作:
我改变了前两行(我认为)正确的数据。
projectnr和api键是假的,只是为了向你展示它的外观。
pre>
import sys,json ,xmpp
SERVER =('gcm.googleapis.com',5235)
USERNAME ='489713985816'
PASSWORD ='AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98'
pre> 我创建了一个google api项目(尝试了两个不同的项目)。
激活的GCM。
复制了以下内容:
项目编号:489713985816
API密钥:AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98
使用服务器密钥和浏览器应用程序的密钥尝试了代码,无论是否使用特定IP地址。
当我用#python ccs.py执行代码时,我得到以下结果:
如果这是我的问题,我该如何获得我的项目列入白名单?
给出的debugflag无效:socket
DEBUG:
DEBUG:为/ usr / lib / python2.7 / dist-packages / xmpp / client.py
DEBUG:flags defined:socket
DEBUG:socket start在0x1ea2950处插入< xmpp.transports.TCPsocket实例>
转换为0x1ea27a0处的< xmpp.client.Client实例>
DEBUG:socket start成功连接到远程
主机('gcm.googleapis.com',5235)
DEBUG:发送套接字<?xml version ='1.0'?>
< stream:stream xmlns =jabber:clientto =gcm.googleapis.comversion =1.0
xmlns:stream =http://etherx.jabber.org/streams >
DEBUG:socket得到
xmlns:stream =http:// etherx .jabber.org / streamsxmlns =jabber:client>
< 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:套接字发送< auth xmlns =urn:ietf:params:xml:ns:xmpp-sasl
mechanism =PLAIN> MjgzMVqTl9p \\\
VDdUTZWSjk4\\\
< / auth>
DEBUG:socket得到<失败xmlns =urn:ietf:params:xml:ns:xmpp-sasl>
< temporary-auth-failure />
< text xmlns =urn:ietf:params:xml:ns:xmpp-stanzas>
项目489713985816未列入白名单。< / text>
< /失败>
< / stream:stream>
身份验证失败!
经过3个月的等待,我刚刚收到来自Google员工的电子邮件。
我的GCM白名单请求已获批准。
谢谢Ashish。
现在,让我们开始吧!
I'm trying to get the Python code working that I found on:http://developer.android.com/google/gcm/ccs.htmlI've change the first 2 rows with (I think) the correct data.The projectnr and api key is fake, it's just to show you how it almost looks.
import sys, json, xmpp
SERVER = ('gcm.googleapis.com', 5235)
USERNAME = '489713985816'
PASSWORD = 'AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98'
I've created a google api project (tried it with 2 different projects).Activated GCM.Copied the following:Project Number: 489713985816API key : AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98Tried the code with a Key for server, and a key for browser apps, both with and without a specific IP address.
When I execute the code with #python ccs.py I get the following result:If this is my problem, how do I get my project whitelisted?
Invalid debugflag given: socket
DEBUG:
DEBUG: Debug created for /usr/lib/python2.7/dist-packages/xmpp/client.py
DEBUG: flags defined: socket
DEBUG: socket start Plugging <xmpp.transports.TCPsocket instance at 0x1ea2950>
into <xmpp.client.Client instance at 0x1ea27a0>
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 got
<stream:stream from="gcm.googleapis.com" id="FD82304ADA8C8019" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
<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">MjgzMVqTl9p\nVDdUTZWSjk4\n</auth>
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 489713985816 not whitelisted.</text>
</failure>
</stream:stream>
Authentication failed!
After 3 months of waiting, I've just received an email from a Google employee.My GCM whitelist request has been approved.Thank you Ashish.Now, let the fun begin!
这篇关于Google CCS(GCM) - 项目未列入白名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!