According to Flask sessions documentation:
…
What this means is that the user could look at the contents of your
cookie but not modify it, unless they know the secret key used for
signing.In order to use sessions you have to set a secret key.
Set secret key. And you should return string, not int.
#!/usr/bin/env python
from flask import Flask, session
app = Flask(__name__)
@app.route("https://stackoverflow.com/")
def run():
session['tmp'] = 43
return '43'
if __name__ == '__main__':
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
app.run()