# -*- coding: utf-8 -*-
import jpush
from odoo import models, fields, api
app_key = "6e6ce8723531335ce45edd34"
master_secret = "64ec88028aac4dda6286400e"
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
_jpush.set_logging("DEBUG")

need_sound = "a.caf"
apns_production = False
class JPushExtend:
    @classmethod
    def send_push(cls, platform=jpush.all_, audience=None, notification=None, message=None, apns_production=False):
        push.audience = audience
        ios = jpush.ios(alert=notification, sound=need_sound)
        android = jpush.android(alert=notification, priority=1, style=1)
        push.notification = jpush.notification(ios=ios, android=android)
        push.options = {"apns_production":apns_production,}
        push.platform = platform
        # push.message = message
        try:
            response = push.send()
        except jpush.common.Unauthorized:
            raise jpush.common.Unauthorized("Unauthorized")
        except jpush.common.APIConnectionException:
            raise jpush.common.APIConnectionException("conn")
        except jpush.common.JPushFailure:
            print ("JPushFailure")
        except:
            print ("Exception")



# JPushExtend.send_push(platform=jpush.all_, audience= "all", notification="My First Push")
b6113e39b15a534f96f9aebd5753a9bd2988333c
<mask token>


class JPushExtend:
    <mask token>

<mask token>


class JPushExtend:

    @classmethod
    def send_push(cls, platform=jpush.all_, audience=None, notification=
        None, message=None, apns_production=False):
        push.audience = audience
        ios = jpush.ios(alert=notification, sound=need_sound)
        android = jpush.android(alert=notification, priority=1, style=1)
        push.notification = jpush.notification(ios=ios, android=android)
        push.options = {'apns_production': apns_production}
        push.platform = platform
        try:
            response = push.send()
        except jpush.common.Unauthorized:
            raise jpush.common.Unauthorized('Unauthorized')
        except jpush.common.APIConnectionException:
            raise jpush.common.APIConnectionException('conn')
        except jpush.common.JPushFailure:
            print('JPushFailure')
        except:
            print('Exception')

<mask token>
app_key = '6e6ce8723531335ce45edd34'
master_secret = '64ec88028aac4dda6286400e'
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
_jpush.set_logging('DEBUG')
need_sound = 'a.caf'
apns_production = False


class JPushExtend:

    @classmethod
    def send_push(cls, platform=jpush.all_, audience=None, notification=
        None, message=None, apns_production=False):
        push.audience = audience
        ios = jpush.ios(alert=notification, sound=need_sound)
        android = jpush.android(alert=notification, priority=1, style=1)
        push.notification = jpush.notification(ios=ios, android=android)
        push.options = {'apns_production': apns_production}
        push.platform = platform
        try:
            response = push.send()
        except jpush.common.Unauthorized:
            raise jpush.common.Unauthorized('Unauthorized')
        except jpush.common.APIConnectionException:
            raise jpush.common.APIConnectionException('conn')
        except jpush.common.JPushFailure:
            print('JPushFailure')
        except:
            print('Exception')

import jpush
from odoo import models, fields, api
app_key = '6e6ce8723531335ce45edd34'
master_secret = '64ec88028aac4dda6286400e'
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
_jpush.set_logging('DEBUG')
need_sound = 'a.caf'
apns_production = False


class JPushExtend:

    @classmethod
    def send_push(cls, platform=jpush.all_, audience=None, notification=
        None, message=None, apns_production=False):
        push.audience = audience
        ios = jpush.ios(alert=notification, sound=need_sound)
        android = jpush.android(alert=notification, priority=1, style=1)
        push.notification = jpush.notification(ios=ios, android=android)
        push.options = {'apns_production': apns_production}
        push.platform = platform
        try:
            response = push.send()
        except jpush.common.Unauthorized:
            raise jpush.common.Unauthorized('Unauthorized')
        except jpush.common.APIConnectionException:
            raise jpush.common.APIConnectionException('conn')
        except jpush.common.JPushFailure:
            print('JPushFailure')
        except:
            print('Exception')

# -*- coding: utf-8 -*-
import jpush
from odoo import models, fields, api
app_key = "6e6ce8723531335ce45edd34"
master_secret = "64ec88028aac4dda6286400e"
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
_jpush.set_logging("DEBUG")

need_sound = "a.caf"
apns_production = False
class JPushExtend:
    @classmethod
    def send_push(cls, platform=jpush.all_, audience=None, notification=None, message=None, apns_production=False):
        push.audience = audience
        ios = jpush.ios(alert=notification, sound=need_sound)
        android = jpush.android(alert=notification, priority=1, style=1)
        push.notification = jpush.notification(ios=ios, android=android)
        push.options = {"apns_production":apns_production,}
        push.platform = platform
        # push.message = message
        try:
            response = push.send()
        except jpush.common.Unauthorized:
            raise jpush.common.Unauthorized("Unauthorized")
        except jpush.common.APIConnectionException:
            raise jpush.common.APIConnectionException("conn")
        except jpush.common.JPushFailure:
            print ("JPushFailure")
        except:
            print ("Exception")



# JPushExtend.send_push(platform=jpush.all_, audience= "all", notification="My First Push")