How to create simple python webservice

Create file helloworld.py #!/usr/bin/env python ''' Created on Apr 10, 2013 @author: kowalczy ''' import web urls = ( '/hello/(.*)', 'hello', '/.*' , 'index' ) usage="Example usage : \n"+"http://server:port/hello/name \n" class index: def GET(self): return "\n"+ usage class hello: def GET(self, name): if name=='': return "Hello unknown" else: return "Hello " + name if __name__ … Continue reading How to create simple python webservice

Advertisements

How to send GET and POST request with wget

GET request wget -S --header="Accept-Encoding: gzip, deflate" -O response.txt http://server:8080/application/params POST request wget -S --header="Accept-Encoding: gzip, deflate" --header='Accept-Charset: UTF-8' --header='Content-Type: application/json' -O response.json --post-data '{"param1":"myspecialValue1","param2":"my special value 2"}' http://server:8080/application2/params2