How to use the jpush.common function in jpush

To help you get started, we’ve selected a few jpush 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 jpush / jpush-api-python-client / tests / devices / test_devices.py View on Github external
def test_clear_tag(self):
        reg_id = '090c1f59f89'
        entity = jpush.device_tag("")
        try:
            device.set_deviceinfo(reg_id, entity)
        except common.JPushFailure:
            self.assertEqual(1, 1)
        except:
            self.assertEqual(1, 0)
github jpush / jpush-api-python-client / tests / push / test_message.py View on Github external
def test_push(self):
        _jpush = jpush.JPush(app_key, master_secret)
        push = _jpush.create_push()
        push.audience = jpush.all_
        push.notification = jpush.notification(alert="hello python jpush api")
        push.platform = jpush.all_
        try:
            response = push.send()
            print response.status_code
            self.assertEqual(response.status_code, 200)
        except common.Unauthorized, e:
            self.assertFalse(isinstance(e, common.Unauthorized))
            raise common.Unauthorized("Unauthorized")
        except common.APIConnectionException, e:
            self.assertFalse(isinstance(e, common.APIConnectionException))
            raise common.APIConnectionException("conn")
        except common.JPushFailure, e:
            self.assertFalse(isinstance(e, common.JPushFailure))
            print "JPushFailure"
        except:
            self.assertFalse(1)
            print "Exception"
github jpush / jpush-api-python-client / jpush / push / core.py View on Github external
def get_cid(self, count, type = None):
        body = None
        url = common.get_url('push', self.zone) + 'push/cid'

        params = {
            'count': count,
            'type': type
        }
        response = self._jpush._request('GET', body, url, 'application/json', version=3, params = params)
        return PushResponse(response)
github jpush / jpush-api-python-client / jpush / schedule / core.py View on Github external
def send(self, method, body,url,base_url=None):
        """Send the request
        """
        response = self._jpush._request(method, body,url,common.PUSH_BASEURL)
        return response