Search code examples
pythonhttpgoogle-app-engineurlurl-parameters

passing URL as args to handler in apps-engine


I want to create an apps enginge that get command via url. How can I acsees the URL from within the handlers?

class Handler:
    def get(self):
        url = ? #Here I want to access the url and parse it
        self.response.write(url)

def main():
   application = webapp.WSGIApplication([
           ('/get',   Handler)])

Solution

  • I'm accessing the request URL like this:

    logging.info('URL: %s' % self.request.path_info)
    

    I am using webapp2, it's true, but it should work with webapp as well as path_info actually comes from webob, which both frameworks are based on.