Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
request = HTTPRequest(
url=self.FCM_END_POINT,
method='POST',
headers=self.request_headers(),
body=payload
)
response = yield self.http_client.fetch(request)
if response.code == 200:
yield self.parse_response(response)
return
elif response.code == 401:
raise AuthenticationError('There was an error authenticating the sender account')
elif response.code == 400:
raise InternalPackageError('Unknown internal error')
else:
raise FCMServerError('FCM server is temporarily unavailable')