[英]TypeError during send_message in django push notifications 1.2.1, python 3.4, django 1.8.1
開火期間:
GCMDevice.send_message(message)
我得到:
File "/home/vagrant/.venvs/any_dev/lib/python3.4/site-packages/push_notifications/gcm.py", line 103, in _gcm_send_json
result = json.loads(_gcm_send(data, "application/json"))
File "/usr/local/lib/python3.4/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
據說lib與python 3.x兼容,但是我想編碼存在問題。 有人經歷過類似的事情嗎?
在gcm.py中(以我為例,位於〜/ .virtualenvs / grape / lib / python3.4 / site-packages / push_notifications / gcm.py)
更換
result = json.loads(_gcm_send(data, "application/json"))
至
result = json.loads(_gcm_send(data, "application/json").decode('utf8'))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.