Have a look at URI routing in webapp2. Here you can match / route an URI and get the arguments. These keyword arguments are passed to your handler : http://webapp2.readthedocs.io/en/latest/guide/routing.html#the-url-template
Here is a helloworld example with one argument {action} :
#!/usr/bin/python
# -*- coding: utf-8 -*-
import webapp2
class ActionPage(webapp2.RequestHandler):
def get(self, action):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Action, ' + action)
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([
webapp2.Route(r'/<action:(start|failed)>', handler=ActionPage),
webapp2.Route(r'/', handler=MainPage),
], debug=True)
And your app.yaml:
application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: false
handlers:
- url: (.*)
script: helloworld.app
libraries:
- name: webapp2
version: latest
This works fine in the SDK when I try
http://localhost:8080/start # result: Action, start
or
http://localhost:8080 # result: Hello, webapp2 World!