Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:07:32+00:00 2026-05-27T09:07:32+00:00

in my webapp2.RequestHandler method: I want to find out which uri the requester want

  • 0

in my webapp2.RequestHandler method:

I want to find out which uri the requester want to get.
for example, if the user wants to get “http://www.mysite.com/products/table”
I want to get into a variable the value “table” (in this case)

when I print “self.request” I see all the values of RequestHandler class
but I didn’t managed to find out what is the right attribute in my case.

I’m sure the question is an easy-one for you, but I’m just a starter in python and app-engine framework.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:07:32+00:00Added an answer on May 27, 2026 at 9:07 am

    Looked into how URLs should be handled, and wildcard URLs. Try this:

    class ProductsHandler(webapp.RequestHandler):
        def get(self, resource):
            self.response.headers['Content-Type'] = 'text/plain'
            table = self.request.url
            self.response.out.write(table)
            self.response.out.write("\n")
            self.response.out.write(resource)
    
    def main():
        application = webapp.WSGIApplication([
            ('/products/(.*)', ProductsHandler)
            ],
            debug=True)
        util.run_wsgi_app(application)
    

    When I go to the URL http://localhost:8080/products/table, I get this result:

    http://localhost:8080/products/table
    table

    The resource parameter of the get function is passed in automatically by the WSGIApplication url_mapping, because it is mapped to:

    ('/products/(.*)', ProductsHandler)
    

    The (.*) is a wildcard, and gets passed in as a method parameter.

    You could name the parameter in the get method anything you want instead of resource, such as table. It wouldn’t make a lot of sense though, because if you pass in a url like http://localhost:8080/products/fish, it would no longer contain the word “table”.


    Earlier attempt (before edits):

    Try something like this:

    class MainHandler(webapp.RequestHandler):
        def get(self):
            table = self.request.url
            self.response.out.write(table)
    

    For my test, I went to http://localhost:8080/, and it printed out:

    http://localhost:8080/

    See the docs for the Request class here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class sss(webapp.RequestHandler): def get(self): url = http://www.google.com/ result = urlfetch.fetch(url) if result.status_code == 200:
take this example from google docs class BrowseHandler(webapp.RequestHandler): > def get(self, category, product_id): >
('/\d+\?fmt=json',JsonHandler) class JsonHandler(webapp.RequestHandler): def get(self): self.response.out.write(hello) Hey, I am using google app engine python
I have something like this set up: class CategoryPage (webapp.RequestHandler): def get(self): ** DO
I think I'm using the Users API incorrectly: class BaseHandler(webapp.RequestHandler): user = users.get_current_user() def
webapp.RequestHandler based Handlers can override initialize () to carry out setup. Is there a
Can anyone help me out of this problem, my javascript has an ajax GET
I have a class that doesn't extend webapp.RequestHandler , and I can't use self.response.out.write()
In GAE Python, I could use class MyRequestHandler(webapp.RequestHandler): def get(self): pass #Do Something... def
I'm trying to follow the Auth example for Webapp2 that can be found here:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.