How to use the pyfcm.errors.FCMError function in pyfcm

To help you get started, we’ve selected a few pyfcm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github olucurious / PyFCM / pyfcm / errors.py View on Github external
class AuthenticationError(FCMError):
    """
    API key not found or there was an error authenticating the sender
    """
    pass


class FCMNotRegisteredError(FCMError):
    """
    push token is not registered
    https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
    """
    pass


class FCMServerError(FCMError):
    """
    Internal server error or timeout error on Firebase cloud messaging server
    """
    pass


class InvalidDataError(FCMError):
    """
    Invalid input
    """
    pass


class InternalPackageError(FCMError):
    """
    JSON parsing error, please create a new github issue describing what you're doing
github olucurious / PyFCM / pyfcm / errors.py View on Github external
class FCMError(Exception):
    """
    PyFCM Error
    """
    pass

class AuthenticationError(FCMError):
    """
    API key not found or there was an error authenticating the sender
    """
    pass


class FCMNotRegisteredError(FCMError):
    """
    push token is not registered
    https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
    """
    pass


class FCMServerError(FCMError):
    """
github olucurious / PyFCM / pyfcm / errors.py View on Github external
class FCMError(Exception):
    """
    PyFCM Error
    """
    pass

class AuthenticationError(FCMError):
    """
    API key not found or there was an error authenticating the sender
    """
    pass


class FCMNotRegisteredError(FCMError):
    """
    push token is not registered
    https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
    """
    pass


class FCMServerError(FCMError):
    """
    Internal server error or timeout error on Firebase cloud messaging server
    """
    pass


class InvalidDataError(FCMError):
    """
github olucurious / PyFCM / pyfcm / baseapi.py View on Github external
InvalidDataError: data sent to server was incorrectly formatted
            FCMError: an error occured on the server
        """
        url = 'https://iid.googleapis.com/iid/v1:batchAdd'
        payload = {
            'to': '/topics/' + topic_name,
            'registration_tokens': registration_ids,
        }
        response = self.requests_session.post(url, json=payload)
        if response.status_code == 200:
            return True
        elif response.status_code == 400:
            error = response.json()
            raise InvalidDataError(error['error'])
        else:
            raise FCMError()
github olucurious / PyFCM / pyfcm / errors.py View on Github external
class FCMNotRegisteredError(FCMError):
    """
    push token is not registered
    https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
    """
    pass


class FCMServerError(FCMError):
    """
    Internal server error or timeout error on Firebase cloud messaging server
    """
    pass


class InvalidDataError(FCMError):
    """
    Invalid input
    """
    pass


class InternalPackageError(FCMError):
    """
    JSON parsing error, please create a new github issue describing what you're doing
    """
    pass


class RetryAfterException(Exception):
    """
    Retry-After must be handled by external logic.
github olucurious / PyFCM / pyfcm / errors.py View on Github external
class FCMServerError(FCMError):
    """
    Internal server error or timeout error on Firebase cloud messaging server
    """
    pass


class InvalidDataError(FCMError):
    """
    Invalid input
    """
    pass


class InternalPackageError(FCMError):
    """
    JSON parsing error, please create a new github issue describing what you're doing
    """
    pass


class RetryAfterException(Exception):
    """
    Retry-After must be handled by external logic.
    """
    def __init__(self, delay):
        self.delay = delay
github olucurious / PyFCM / pyfcm / baseapi.py View on Github external
InvalidDataError: data sent to server was incorrectly formatted
            FCMError: an error occured on the server
        """
        url = "https://iid.googleapis.com/iid/v1:batchRemove"
        payload = {
            'to': '/topics/' + topic_name,
            'registration_tokens': registration_ids,
        }
        response = self.requests_session.post(url, json=payload)
        if response.status_code == 200:
            return True
        elif response.status_code == 400:
            error = response.json()
            raise InvalidDataError(error['error'])
        else:
            raise FCMError()