(self, request, version, username, device_uid)
return JsonResponse({"timestamp": now, "update_urls": update_urls})
Client sends subscription updates
Client sends subscription updates
Client sends subscription updates
def post(self, request, version, username, device_uid):
        """Client sends subscription updates"""
        now = get_timestamp(datetime.utcnow())
        logger.info(
            "Subscription Upload @{username}/{device_uid}".format(
                username=request.user.username, device_uid=device_uid
            )
        )

        d = get_device(
            request.user, device_uid, request.META.get("HTTP_USER_AGENT", "")
        )

        actions = self.parsed_body(request)

        add = list(filter(None, actions.get("add", [])))
        rem = list(filter(None, actions.get("remove", [])))
        logger.info(
            "Subscription Upload @{username}/{device_uid}: add "
            "{num_add}, remove {num_remove}".format(
                username=request.user.username,
                device_uid=device_uid,
                num_add=len(add),
                num_remove=len(rem),
            )
        )

        update_urls = self.update_subscriptions(request.user, d, add, rem)

        return JsonResponse({"timestamp": now, "update_urls": update_urls})
def post ( self , request , version , username , device_uid ) : now = get_timestamp ( datetime . utcnow ( ) ) logger . info ( "Subscription Upload @{username}/{device_uid}" . format ( username = request . user . username , device_uid = device_uid ) ) d = get_device ( request . user , device_uid , request . META . get ( "HTTP_USER_AGENT" , "" ) ) actions = self . parsed_body ( request ) add = list ( filter ( None , actions . get ( "add" , [ ] ) ) ) rem = list ( filter ( None , actions . get ( "remove" , [ ] ) ) ) logger . info ( "Subscription Upload @{username}/{device_uid}: add " "{num_add}, remove {num_remove}" . format ( username = request . user . username , device_uid = device_uid , num_add = len ( add ) , num_remove = len ( rem ) , ) ) update_urls = self . update_subscriptions ( request . user , d , add , rem ) return JsonResponse ( { "timestamp" : now , "update_urls" : update_urls } )