Parameter in page URL

Asked

Viewed 100 times

0

Dear, I need to create a Pyramid application for use of API.

1 - "/Quotes/< quote_number>" - Present page containing the quote returned by the API corresponding to < quote_number >.

I already know how to create a static page in Pyramid, but I don’t know how to create a page that receives the parameter in the url.

1 answer

1


Given the content of this page, just set the parameter in the URL between keys, such as {parametro} and use it through request.matchdict. Take an example:

@view_config(route_name='quotes_number')
def quotes_number(request):
    return Response(request.matchdict['quote_number'])

config.add_route('quotes_number', 'quotes/{quote_number}')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.