# Lookup Plugin XML encoded Output

**URL:** <https://forum.ansible.com/t/lookup-plugin-xml-encoded-output/28948>\
**Category:** Ansible Developer\
**Created:** [November 5, 2018, 9:41pm UTC](https://forum.ansible.com/t/lookup-plugin-xml-encoded-output/28948 "2018-11-05T21:41:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken\_partridge](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@ken\_partridge](https://forum.ansible.com/u/ken_partridge)\
**Post date:** [November 5, 2018, 9:41pm UTC](https://forum.ansible.com/t/lookup-plugin-xml-encoded-output/28948/1 "2018-11-05T21:41:20Z")

</div>

Hello, We have a lookup plugin we are developing. It uses open\_url() to grab an XML file and display it. Pretty simple, The problem is that the output comes back with the text encoded (i.e. " and \r and \n and %29 etc etc).

In Python, in the lookup plugin, we obviously tried replace(), but when we run the lookup plugin the output goes back to the " \r \n characters.

We were hoping for a canned solution so our customers don’t have to take this output and run it through a decoder.

Any help pointing us in a general direction would be greatly appreciated.

In a nutshell this is it:

`  
response = open\_url(fullurl, validate\_certs=self.get\_option(‘validate\_certs’), use\_proxy=self.get\_option(‘use\_proxy’), headers={‘Content-Type’: ‘application/json’, ‘Authorization’: “Basic %s” % auth})

ret.append(to\_text(response.read()))  
`

Thanks
