1

I have simple python service which is working fine. And i want to deploy it on IIS. Is it possible? If yes then how? Following is code of my service. TestService.py

import web
import xml.etree.ElementTree as ET

tree = ET.parse('user_data.xml')
root = tree.getroot()

urls = (
    '/users', 'list_users',
    '/users/(.*)', 'get_user'
)

app = web.application(urls, globals())

class list_users:        
    def GET(self):
    output = 'users:[';
    for child in root:
                print 'child', child.tag, child.attrib
                output += str(child.attrib) + ','
    output += ']';
        return output

class get_user:
    def GET(self, user):
    for child in root:
        if child.attrib['id'] == user:
            return str(child.attrib)

if __name__ == "__main__":
    app.run()

And user_data.xml

<users>
    <user id="10" name="Rocky" age="38"/>
    <user id="20" name="Steve" age="50"/>
    <user id="30" name="Melinda" age="38"/>
</users>

i have read this post Python on IIS: how? but it is not working for me.

Community
  • 1
  • 1
Sheraz
  • 567
  • 4
  • 22

0 Answers0