小编anh*_*nho的帖子

Firebase FCM错误:“ InvalidRegistration”

目前我正在试图发送PushNotificationDevice Group使用FCM的帮助下Firebase Cloud Functions,但一旦通知发出,它的代码返回200,但失败:

SUCCESS response= {
multicast_id: 8834986220110966000,
success: 0,
failure: 1,
canonical_ids: 0,
results: [ { error: 'InvalidRegistration' } ] 
}
Run Code Online (Sandbox Code Playgroud)

这是我用来发送此通知的代码...我缺少什么?

const options = {
    method: 'POST',
    uri: 'https://fcm.googleapis.com/fcm/send',
    headers: {
       'Authorization': 'key=' + serverKey,
    },
    body: {
       to: groupId,
       data: {
        subject: message
       },
       notification: {
         title: title,
         body: body,
         badge: 1,
        },
       content_available: true
    },
    json: true
};

return rqstProm(options)
    .then((parsedBody) => {
        console.log('SUCCESS response=', …
Run Code Online (Sandbox Code Playgroud)

javascript node.js firebase firebase-cloud-messaging

7
推荐指数
2
解决办法
2万
查看次数

TypeError:“标记”类型的对象不可JSON序列化

我试图创建一个JSON对象并将其发送到Firebase Databaseusing python,但是当我这样做时,我得到:

TypeError: Object of type 'Tag' is not JSON serializable

这是我的代码:

data = {'address': address,
    'name': name
   }

print(type(data))
sent = json.dumps(data)
result = firebase.post("/tHouse/houseTest", sent)  
Run Code Online (Sandbox Code Playgroud)

这是有问题的,json.dumps(data)因为此处指出了错误。print(type(data))虽然运行返回<class 'dict'>

另外,nameaddress预先设定

python json firebase firebase-realtime-database firebase-admin

3
推荐指数
1
解决办法
9252
查看次数

urlretrieve for image返回HTTP错误403:禁止

嘿伙计们,我正在尝试使用BeautifulSoup获取图像但是这样做时我收到错误:

这是我的代码:

imgUrl = "https://www.residentadvisor.net/images/events/flyer/2017/7/no-0713-986042-front.jpg"
try:
    urlretrieve(imgUrl, "testPhytonImg.jpg")
except FileNotFoundError as err:
    print("something wrong with local path")
    print(err)   # something wrong with local path
except HTTPError as err:
    print("something wrong with url")
    print(err)  # something wrong with url
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误: HTTP Error 403: Forbidden

我之所以得到这个?由于我做了什么或是否有另一种方法,对图像的访问是否被阻止?

python beautifulsoup urlretrieve

2
推荐指数
1
解决办法
845
查看次数