Ejemplo n.º 1
0
def queryfeedback():
    logger.info('Running Feedback Task:' + str(current_task.request.id))
    apnssock = APNSSocket()
    apnssock.connect(APNS_FEEDBACK_SANDBOX)
    msg = apnssock.apnsreceive(FEEDBACK_LENGTH)
    while msg:
        logger.info('Feedback Msg received' + str(msg))
        msg = apnssock.apnsreceive(FEEDBACK_LENGTH)
        if msg:
            expired_time = msg[0:4]
            token_length = msg[4:6]
            token = msg[6:]
            logger.info('Removed Token ' + str(binascii.hexlify(token)))
    return
def queryfeedback():
	logger.info('Running Feedback Task:' + str(current_task.request.id))
	apnssock = APNSSocket()
	apnssock.connect(APNS_FEEDBACK_SANDBOX)
	msg = apnssock.apnsreceive(FEEDBACK_LENGTH)
	while msg:
		logger.info('Feedback Msg received' + str(msg))
		msg = apnssock.apnsreceive(FEEDBACK_LENGTH)
		if msg:
			expired_time = msg[0:4]
			token_length = msg[4:6]
			token = msg[6:]
			logger.info('Removed Token ' + str(binascii.hexlify(token)))
	return
class APNSTask(Task):
	abstract = True
	_sock = None

	def __init__(self):
		logger.info('Initialize APNSTask')
		self.gateway = APNS_GATEWAY_SANDBOX

	@property
	def sock(self):
		if self._sock is None:
			self._sock = APNSSocket()
			self._sock.connect(self.gateway)
			logger.info('Connected to APNS')
		return self._sock

	def __del__ (self):
		logger.info('Decomposed APNSTask')
		if self._sock is not None:
			self._sock.close()
Ejemplo n.º 4
0
class APNSTask(Task):
    abstract = True
    _sock = None

    def __init__(self):
        logger.info('Initialize APNSTask')
        self.gateway = APNS_GATEWAY_SANDBOX

    @property
    def sock(self):
        if self._sock is None:
            self._sock = APNSSocket()
            self._sock.connect(self.gateway)
            logger.info('Connected to APNS')
        return self._sock

    def __del__(self):
        logger.info('Decomposed APNSTask')
        if self._sock is not None:
            self._sock.close()
Ejemplo n.º 5
0
class APNSTask(Task):
	abstract = True
	_sock = None

	def __init__(self,gateway=None):
		if gateway is None:
			self.gateway = APNS_GATEWAY_SANDBOX
		else:
			self.gateway = gateway

	@property
	def sock(self):
		if self._sock is None:
			self._sock = APNSSocket()
			self._sock.connect(self.gateway)
			logger.info('Connected to APNS')
		return self._sock

	def reconnect(self):
		self._sock.close()
		self._sock = APNSSocket()
		self._sock.connect(self.gateway)
		logger.info('Re-Connected to APNS')