def handle(self, *args, **kwargs): for event_id in kwargs['event_ids']: event = Event.objects.get(pk=event_id) print(f'Process event {event.name}') qtickets = QTicketsInfo.get_order_list(event.external_id) for item in qtickets: Order.add_or_update(item)
def webhook(request): signature = hmac.new(settings.QTICKETS_SECRET.encode(), request.body, hashlib.sha1).hexdigest() if signature != request.headers.get('X-Signature'): return HttpResponseBadRequest() payload = json.loads(request.body) Order.add_or_update(payload) return HttpResponse()