# Ansible Python API 2.0 - capture warnings

**URL:** <https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240>\
**Category:** Ansible Project\
**Created:** [April 11, 2018, 8:19am UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240 "2018-04-11T08:19:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suren\_Baskaran](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@Suren\_Baskaran](https://forum.ansible.com/u/Suren_Baskaran)\
**Post date:** [April 11, 2018, 8:19am UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240/1 "2018-04-11T08:19:53Z")

</div>

Hello All  
Been circling around the Callbackbase with all possible tries , but I could not find a way till now to capture these warnings from a playbook execution with the API output

[WARNING]: \* Failed to parse hosts/UAT/ dictionary, got: \<class ‘ansible.parsing.yaml.objects.AnsibleUnicode’\>

[WARNING]: \* Failed to parse /hosts/UAT/ssh\_keys/dbrun\_46186\_1\_uat with ini plugin:: Expected key=value host variable assignment, got: RSA

[WARNING]: Could not match supplied host pattern, ignoring: primary\_host

Appreciate some help - on how to capture these warning messages when we run playbooks via the API?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 11, 2018, 1:48pm UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240/2 "2018-04-11T13:48:50Z")

</div>

Warnings are not currently handled by callbacks, the Display class handles them.

---

<div class="post-metadata">

**Author:** ![Suren\_Baskaran](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@Suren\_Baskaran](https://forum.ansible.com/u/Suren_Baskaran)\
**Post date:** [April 12, 2018, 6:22am UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240/3 "2018-04-12T06:22:23Z")

</div>

Thanks for the prompt response Brian

Any examples or references on how to integrate the display with playbook executor callbacks ?

Appreciate your response

Thanks,  
Suren VB

---

<div class="post-metadata">

**Author:** ![Suren\_Baskaran](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@Suren\_Baskaran](https://forum.ansible.com/u/Suren_Baskaran)\
**Post date:** [April 12, 2018, 11:06pm UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240/4 "2018-04-12T23:06:41Z")

</div>

Hey Brain  
Appreciate some pointers here

Thanks,  
Suren VB

---

<div class="post-metadata">

**Author:** ![Suren\_Baskaran](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@Suren\_Baskaran](https://forum.ansible.com/u/Suren_Baskaran)\
**Post date:** [April 16, 2018, 12:11pm UTC](https://forum.ansible.com/t/ansible-python-api-2-0-capture-warnings/27240/5 "2018-04-16T12:11:09Z")

</div>

Hey Guys  
Badly need some pointers here - as I am running out of options

Fiddling with the display Utils gives me the needed verbose but to stdout and not the callbacks

Thanks,  
Suren VB
