'How can I display all the keys and values of the session in Python

I wrote a BPMS program with PHP. But for the online chat section, I used the python web socket.
The problem I have is that I want to get his username when a user connects to the WebSocket.

When a user logs in to the application, one of the values I store in the session is the username.
I want to be able to see all the key-value pairs stored in the session (not only the value of username).

The same thing can be done with var_dump ($ _ SESSION) or with a loop or other ways in PHP, but how can I do this in Python?

Note: I used pure Python (not Django or Flask).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source