'requests.Session.post not sending cookies

I'm using requests library for test my Flask application.

When I'm sending request

sess = requests.Session()
sess.post(
    url=SERVER_URL + '/login',
    data={
        'email': 'chel',
        'password': '1',
        'remember_me': True,
        'csrf_token': BeautifulSoup(requests.get(SERVER_URL + '/login').content, "html.parser").find('input', {'id': 'csrf_token'})['value']
    }
)

And then print received cookies on side of server

@app.route('/login', methods=['GET', 'POST'])
def login():
    print(request.cookies)

I getting empty cookies ImmutableMultiDict([]), but when I'm making request from browser my server outputs ImmutableMultiDict([('session', '(some data)')])



Sources

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

Source: Stack Overflow

Solution Source