python 3.4 use python-gcm can't import

dav.kuhn at gmail.com dav.kuhn at gmail.com
Wed Jun 3 10:33:04 EDT 2015


Le vendredi 29 août 2014 10:35:29 UTC+2, Frank Liou a écrit :

> and body is "b'" .....is empty
> 
> i'm so confused.don't know it work or not

Hi, you should read() before you close() the connection.

conn = http.client.HTTPConnection('android.googleapis.com')
conn.request('POST', '/gcm/send', jqs, headers)
res = conn.getresponse()
body = res.read()
conn.close()
print(body)
David



More information about the Python-list mailing list