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 8948695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:03:41+00:00 2026-06-15T13:03:41+00:00

I am coming from a Java REST background to Python on Google App Engine’s

  • 0

I am coming from a Java REST background to Python on Google App Engine's. I need some help using webapp2 with path-parameters. Below is an example of how Java would read a request. Will someone please translate the code into how python would read it with webapp2?

// URL: my_dogs/user_id/{user_id}/dog_name/{a_name}/breed/{breed}/{weight}

@Path("my_dogs/user_id/{user_id}/dog_name/{a_name}/breed/{breed}/{weight}")
public Response getMyDog(
    @PathParam("user_id") Integer id,
    @PathParam("a_name") String name,
    @PathParam("breed") String breed,
    @PathParam("weight") String weight
){

//the variables are: id, name, breed, weight.
///use them somehow

}

I have already gone over the examples on google ( https://developers.google.com/appengine/docs/python/gettingstartedpython27/usingwebapp ). But I don’t know how to extend the simple

app = webapp2.WSGIApplication([('/', MainPage),
                           ('/sign', Guestbook)],
                          debug=True)
  • 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-06-15T13:03:42+00:00Added an answer on June 15, 2026 at 1:03 pm

    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!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I'm coming from Java background so not too familiar with Javascript. We are
new to Laravel (coming from Java spring), while using Route::get('/', function() { return Hello
I just started learning C++ (coming from Java ) and am having some serious
Coming from a Java background, this is the way I'm thinking: The server provides
Coming from Java background I am guessing this is expected. I would really love
Coming from Java and Python, I am not so well versed in memory management,
Coming from Java, I expected to find some other GUI layout in Visual C++
Coming from Java or Python I am used to making such constructs and normally
I'm starting with Python coming from java. I was wondering if there exists something
I just started learning C++(coming from Java & Python) and am trying to learn

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.