werkzeug.peek_path_info

werkzeug.peek_path_info(environ, charset='utf-8', errors='replace')[source]

Returns the next segment on the PATH_INFO or None if there is none. Works like pop_path_info() without modifying the environment:

>>> env = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/a/b'}
>>> peek_path_info(env)
'a'
>>> peek_path_info(env)
'a'

If the charset is set to None a bytestring is returned.

New in version 0.5.

Changed in version 0.9: The path is now decoded and a charset and encoding parameter can be provided.

Parameters:environ – the WSGI environment that is checked.