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

Function application_uri

Lib/wsgiref/util.py:37–55  ·  view source on GitHub ↗

Return the application's base URI (no PATH_INFO or QUERY_STRING)

(environ)

Source from the content-addressed store, hash-verified

35 return 'http'
36
37def application_uri(environ):
38 """Return the application's base URI (no PATH_INFO or QUERY_STRING)"""
39 url = environ['wsgi.url_scheme']+'://'
40 from urllib.parse import quote
41
42 if environ.get('HTTP_HOST'):
43 url += environ['HTTP_HOST']
44 else:
45 url += environ['SERVER_NAME']
46
47 if environ['wsgi.url_scheme'] == 'https':
48 if environ['SERVER_PORT'] != '443':
49 url += ':' + environ['SERVER_PORT']
50 else:
51 if environ['SERVER_PORT'] != '80':
52 url += ':' + environ['SERVER_PORT']
53
54 url += quote(environ.get('SCRIPT_NAME') or '/', encoding='latin1')
55 return url
56
57def request_uri(environ, include_query=True):
58 """Return the full request URI, optionally including the query string"""

Callers 1

request_uriFunction · 0.85

Calls 2

quoteFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…