MCPcopy Index your code
hub / github.com/python/cpython / get_html_page

Function get_html_page

Lib/pydoc.py:2621–2659  ·  view source on GitHub ↗

Generate an HTML page for url.

(url)

Source from the content-addressed store, hash-verified

2619 return "Error - %s" % url, contents
2620
2621 def get_html_page(url):
2622 """Generate an HTML page for url."""
2623 complete_url = url
2624 if url.endswith('.html'):
2625 url = url[:-5]
2626 try:
2627 if url in ("", "index"):
2628 title, content = html_index()
2629 elif url == "topics":
2630 title, content = html_topics()
2631 elif url == "keywords":
2632 title, content = html_keywords()
2633 elif '=' in url:
2634 op, _, url = url.partition('=')
2635 if op == "search?key":
2636 title, content = html_search(url)
2637 elif op == "topic?key":
2638 # try topics first, then objects.
2639 try:
2640 title, content = html_topicpage(url)
2641 except ValueError:
2642 title, content = html_getobj(url)
2643 elif op == "get?key":
2644 # try objects first, then topics.
2645 if url in ("", "index"):
2646 title, content = html_index()
2647 else:
2648 try:
2649 title, content = html_getobj(url)
2650 except ValueError:
2651 title, content = html_topicpage(url)
2652 else:
2653 raise ValueError('bad pydoc url')
2654 else:
2655 title, content = html_getobj(url)
2656 except Exception as exc:
2657 # Catch any errors and display them in an error page.
2658 title, content = html_error(complete_url, exc)
2659 return html.page(title, content)
2660
2661 if url.startswith('/'):
2662 url = url[1:]

Callers 1

_url_handlerFunction · 0.85

Calls 10

html_indexFunction · 0.85
html_topicsFunction · 0.85
html_keywordsFunction · 0.85
html_searchFunction · 0.85
html_topicpageFunction · 0.85
html_getobjFunction · 0.85
html_errorFunction · 0.85
endswithMethod · 0.45
partitionMethod · 0.45
pageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…