# HG changeset patch # User dwinter # Date 1376550124 -7200 # Node ID ea7017439ab9803da44005f09bc4856defd1e43a # Parent 0190f49bce88b9011edf9b1abc6a320ce2f44569 parameter f?r getPurls added diff -r 0190f49bce88 -r ea7017439ab9 restService/getPurls.py --- a/restService/getPurls.py Thu Jun 06 05:55:09 2013 +0200 +++ b/restService/getPurls.py Thu Aug 15 09:02:04 2013 +0200 @@ -22,22 +22,38 @@ auth = web.ctx.env.get('HTTP_AUTHORIZATION') + params = web.input(); + authreq = False if auth is None:#no authentification needed, SHOULD BE DONE VIA APACHE!! #authreq = True - username = "internal user (Please replace with your username)" + + + if params.get("user",None) is not None: + username = params.get("user") + else: + username = "internal user (Please replace with your username)" + + + else: auth = re.sub('^Basic ','',auth) username,password = base64.decodestring(auth).split(':') + + if params.get("number",None) is not None: + amount = params.get("number") + else: + amount =1 + if authreq: web.header('WWW-Authenticate','Basic realm="Auth example"') web.ctx.status = '401 Unauthorized' return - return self.render.registerPurls(username) + return self.render.registerPurls(username,amount) def POST(self): inp = web.input() diff -r 0190f49bce88 -r ea7017439ab9 restService/templates/registerPurls.html --- a/restService/templates/registerPurls.html Thu Jun 06 05:55:09 2013 +0200 +++ b/restService/templates/registerPurls.html Thu Aug 15 09:02:04 2013 +0200 @@ -1,8 +1,8 @@ -$def with (username) +$def with (username,amount)