def zenpy_update_ticket()

in src/post_comment/app.py [0:0]


def zenpy_update_ticket(output, text_detected_body, images_detected_body):
  
  credentials = {
      'email': os.environ['ZENDESK_EMAIL'],
      'token': os.environ['ZENDESK_TOKEN'],
      'subdomain': os.environ['ZENDESK_SUBDOMAIN']
  }

  zenpy_client = Zenpy(**credentials)

  ticket = zenpy_client.tickets(id=output['attachment_data']['ticket_id'])
  
  ticket.comment = Comment(body=text_detected_body, html_body='<h4>Attachment processed by Amazon Textract & Amazon Rekognition</h4><p>{}<p><p>{}</p>'.format(images_detected_body, text_detected_body), public=False)
  
  zenpy_client.tickets.update(ticket)

  return