celery trying again

本文介绍了一个使用极光推送(JPush)进行消息推送的实际案例。通过Python脚本实现了针对特定用户的推送,并展示了如何设置推送内容、数据参数及iOS推送选项等。尽管在执行过程中遇到了无法找到目标用户的错误,但该实例仍为开发者提供了实现精准推送的有效参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

response = push.send()
Request failed with status 400: '1011 {'code': 1011, 'message': 'cannot find user by this audience'}': "cannot find user by this audience"

import jpush
_jpush = jpush.JPush('38445dcca2aaf44a9ce7bd4b', '0477f04bbfd8d97c04a9208c') # dev
_jpush = jpush.JPush('fd2370dacc7c25531ed9c55a', '66c6f36049b92664c65520e6') # pro
push = _jpush.create_push()
alias_list = ['39576fb3d5ed72ffb370f521ca93e890']
push.audience = jpush.audience(jpush.alias(*alias_list))

alert = 'test001'
data = {"uri": "", "page": 13, 
        "params": {"duration": 5, 
            "text": {"desc": "这就是一条描述", "title": "标题", 
                "coupons": {"expireAt": "2018-05-29", "status": 0, "ccontrolNo": "F849BF801FD8", "couponType": 1, "price": 0, "redeemCode": "397301100098", "id": 84, "name": "名字", "description": "另一个描述 description", "detail": "详情1,2,3,4"}
            }, 
        "record_id": 438909}, 
        "redbadge": {"100": 1}}
sound = 'default'
ios_production = True
push.notification = jpush.notification(
    alert=alert, ios={"extras": {"data": data}, "sound": sound, "content-available": True,})
push.options = {"apns_production": ios_production}
push.platform = jpush.all_
response = push.send()
print('response: %s' % response.payload)



583b98f9b9d7fb0ec1e65f54:39576fb3d5ed72ffb370f521ca93e890




测试
Sroadcast.send_msg_to_user('586b87213a09807014c1ac83', message='test')

celery worker -A -l info --beat 


celery.worker.consumer  

consumer: Cannot connect to redis://10.44.34.124:16379/6: .
Trying again in 32.00 seconds...

日志等级

http://www.jianshu.com/p/9e422d9f1ce2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值