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)