Skip to content

给reg id发送成功但是无法收到消息 #50

@jiajunhuang

Description

@jiajunhuang

日志:

DEBUG:jpush:Making POST request to https://api.jpush.cn/v3/push. Headers:
        user-agent: jpush-api-python-client
        connection: keep-alive
        content-type: application/json;charset:utf-8
Body:
        {"audience": {"registration_id": ["abcdabcd"]}, "platform": "all", "message": {"msg_content": "by_reg_id", "title": "helloworld"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.jpush.cn:443
DEBUG:urllib3.connectionpool:https://api.jpush.cn:443 "POST /v3/push HTTP/1.1" 200 43
DEBUG:jpush:Received 200 response. Headers:
        Server: nginx
        Date: Wed, 11 Dec 2019 14:04:53 GMT
        Content-Type: application/json
        Content-Length: 43
        Connection: keep-alive
        X-Rate-Limit-Limit: 600
        X-Rate-Limit-Remaining: 599
        X-Rate-Limit-Reset: 60
        X-Jpush-Timestamp: 1576073093486
Body:
        b'{"sendno":"0","msg_id":"47287830529285706"}'

但是用web界面根据reg id发送却能收到。

代码:

def __push_notify_by_reg_id(message, reg_id):
    try:
        push = jp.create_push()
        push.audience = jpush.audience(jpush.registration_id(reg_id))
        push.message = jpush.message(message.brief, message.title)
        push.platform = jpush.all_

        push.send()
    except Exception:
        logging.exception("failed to push message(%d)", message.id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions