# Filtering data from system.net.httpGet

**URL:** <https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572>\
**Category:** Ignition\
**Created:** [January 20, 2015, 12:08pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572 "2015-01-20T12:08:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Micky.Franks](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Micky.Franks](https://forum.inductiveautomation.com/u/Micky.Franks)\
**Post date:** [January 20, 2015, 12:08pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/1 "2015-01-20T12:08:10Z")

</div>

I am trying to use the example in the manual for system.net.httpGet and I am unable to figure out the correct expression and match to pull the data values I need. I am able to reach the page and get the string of info back but I am to get the information I need out of it.

The data I need is coming back in this format Value

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 20, 2015, 2:01pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/2 "2015-01-20T14:01:33Z")

</div>

I think [this topic](https://www.inductiveautomation.com/forum/viewtopic.php?f=25&t=7436) may help you out.

---

<div class="post-metadata">

**Author:** ![Micky.Franks](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Micky.Franks](https://forum.inductiveautomation.com/u/Micky.Franks)\
**Post date:** [January 21, 2015, 11:35am UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/3 "2015-01-21T11:35:54Z")

</div>

Your post helped but I am still screwing up something somewheres.

A system.net.httpGet gives me `<temp_f>51.0</temp_f>
<r_humid>99</r_humid>`

My script is to extract the values from that is [code]response = system.net.httpGet(“[http://191.192.168.50/index.xml](http://191.192.168.50/index.xml)”)

# import Python’s regular expression library

import re

# NOTE - if you’ve never seen regular expressions before, don’t worry, they look

# confusing even to people who use them frequently.

pattern = re.compile(’._?\<._?\>(._?)\</._?\>’, re.DOTALL)

match = pattern.match(response)

if match:

subText = match.group(1)

temp\_f = re.compile(’._?temp\_f"(._?)"’).match(subText).group(1)

r\_humid = re.compile(’._?r\_humid"(._?)"’).match(subText).group(1)

print "Temperature: ", temp\_f

print "Humidity: ", r\_humid

else:

print ‘No Data’[/code]

Only part that’s working so far is the print 'No Data" 😃

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 21, 2015, 12:08pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/4 "2015-01-21T12:08:57Z")

</div>

Could you post what gets returned from the httpGet? That might let me wrap my head around it a little better.

EDIT: Never mind. I need more coffee… 😆

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 21, 2015, 12:45pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/5 "2015-01-21T12:45:43Z")

</div>

Let’s try simplifying a bit.

re.findall will return a list of values:

[code]response="""\<temp\_f\>51.0\</temp\_f\>  
\<r\_humid\>99\</r\_humid\>"""

import re  
pattern = re.compile(’._?\<._?\>(._?)\</._?\>’, re.DOTALL)

match=re.findall(pattern, response)  
print “temp\_f:”, match[0]  
print “r\_humid:”, match[1]  
[/code]

---

<div class="post-metadata">

**Author:** ![Micky.Franks](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Micky.Franks](https://forum.inductiveautomation.com/u/Micky.Franks)\
**Post date:** [January 21, 2015, 1:46pm UTC](https://forum.inductiveautomation.com/t/filtering-data-from-system-net-httpget/9572/6 "2015-01-21T13:46:03Z")

</div>

> [@JordanCClark](#):
>
> Let's try simplifying a bit.

That worked!
