with requests.Session() as s:
    r = s.post(url, data=payload)
cookie = {'PHPSESSID': requests.utils.dict_from_cookiejar(s.cookies)[
    'PHPSESSID']}
Python Requests: Logging into website using POST and Cookies