# Web Dev Python Tag Read

**URL:** <https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116>\
**Category:** General Discussion\
**Created:** [April 23, 2017, 5:50pm UTC](https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116 "2017-04-23T17:50:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjsubbu](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kjsubbu](https://forum.inductiveautomation.com/u/kjsubbu)\
**Post date:** [April 23, 2017, 5:50pm UTC](https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116/1 "2017-04-23T17:50:37Z")

</div>

Hi,

I am trying do read some tags in webdev modules with Python.  
Can any one give sample script to test it

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [April 23, 2017, 8:37pm UTC](https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116/2 "2017-04-23T20:37:58Z")

</div>

In Ignition you need to create a python resource.  
You can write the following code in the doPost section. It’s worth reading up on the differences of GET, POST and PUT commands.  
Code for a basic tag read can look something like this:

```auto
	tagPath = request['params']['tagPath']
	tagVal = system.tag.read(tagPath).value
	
	return {'json': system.util.jsonEncode(tagVal)}

```

You will need to remember to add the Tag Provider to the TagPath variable. ie: probably “[default]”

Javascript function in your web app:

```auto
function readTag(){
	$.ajax({
		type: "POST",
		url: "../python/getTag",
		data: {"tagPath":"[Default]Silos/MilkSilo1/PP10001/Run"},
		contentType: "application/x-www-form-urlencoded",
		success: function(result){
			if (result){
				// Do something with results
			
			} else {
				// Error with tag read in Ignition
				// Do something else
			}
		},
	});
}

```

The url “/python/getTag” represents the path in your WebDev directory in Ignition.

---

<div class="post-metadata">

**Author:** ![matt.eaton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matt.eaton/32/72046_2.png) [@matt.eaton](https://forum.inductiveautomation.com/u/matt.eaton)\
**Post date:** [April 24, 2017, 9:25pm UTC](https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116/3 "2017-04-24T21:25:44Z")

</div>

Also a nice easy way to test is an application like the [Advanced Rest Client] ([https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo](https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo)) in order to create the POST message without a webpage.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [April 25, 2017, 2:44pm UTC](https://forum.inductiveautomation.com/t/web-dev-python-tag-read/14116/4 "2017-04-25T14:44:24Z")

</div>

This blog post giving an example of using the WebDev Module might be useful in general: [http://blog.perfectabstractions.com/2017/03/21/bring-your-ignition-data-to-the-web-with-the-webdev-module/](http://blog.perfectabstractions.com/2017/03/21/bring-your-ignition-data-to-the-web-with-the-webdev-module/)
