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

  • Home
  • SEARCH
  • 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 9039203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:40:31+00:00 2026-06-16T09:40:31+00:00

given the following (sample) handlers (taken from here ): handlers = [ (r/, MainHandler),

  • 0

given the following (sample) handlers (taken from here):

handlers = [
            (r"/", MainHandler),
            (r"/auth/login", AuthLoginHandler),
            (r"/auth/logout", AuthLogoutHandler),
        ]

is there a way to programmatically print the handlers on a separate page? I was thinking something along the lines of:

handlers = [
            (r"/", MainHandler),
            (r"/auth/login", AuthLoginHandler),
            (r"/auth/logout", AuthLogoutHandler),
            (r"/routes", RoutePrinter),
        ]

...

class RoutePrinter(...):
    def get(self):
       self.write(str(self.application.routes))

which gives me
[(<_sre.SRE_Pattern object at 0x216c130>, [, , , , , , , , , , , , , , , , , , , , , , ])]

I’ve tried a few different accessors but doesn’t really help. Is it possible to generate a list of my routes?

EDIT

Based on further searching, I have come across ways to print a pattern/flag from these regex objects. The problem is that I am having a hard time understanding how to unnest them since it is not as intuitive as self.application.handlers[0][0] and then self.application.handlers[1][0]. The second is “out of range” even though it looks like it should be “/auth/login”.

What am I missing?

  • 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-16T09:40:33+00:00Added an answer on June 16, 2026 at 9:40 am

    What about this?

    [handler.regex.pattern for handler in self.application.handlers[0][1]]
    

    If you also want the names of the handler classes:

    [(handler.regex.pattern, handler.handler_class) for handler in self.application.handlers[0][1]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

given the following sample table structure is there a way to add to a
Given the following sample XML (here I am showing hard-coded, but normally I load
Given the following code sample: uint8_t i, in, ni; i = in = 2;
A little stuck here. I have a simple question I guess. Given the following
Given following Statment: String query = "Select * from T_spareParts where SparePartPK IN (?
Given the following sample code (Powershell), which is based on this solution : $newFiles
I am using the following code to send a sample message from the content
Given following parameters: Sample size: 16 Channel count: 2 Codec: audio/pcm Byte order: little
Given this following sample code which clones a table row, sets some properties and
Given the following sample of XML and the select statement that shreds the xml

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.