我正在将exponent_server_sdk
用于Python(Django Rest),并且不断收到此错误:
exponent_server_sdk.PushServerError: Request failed
我的代码如下:
@api_view(["POST"])
@permission_classes((AllowAny, ))
def send_push_message(request):
token = request.data['token']
title = request.data['title']
message = request.data['message']
extra = request.data['extra']
try:
response = PushClient().publish(
PushMessage(to=token, title=title, body=message, data=extra))
except PushServerError as exc:
rollbar.report_exc_info(
extra_data={'token': token, 'title': title, 'message': message,'extra': extra, 'errors': exc.errors, 'response_data': exc.response_data,})