I was recently looking for a library that did this and couldn't find anything nice. I was surprised but also slightly disappointed to see that yt-dlp has essentially rolled their own (cookies.py [1]).
chr_cookies = pycookiecheat.chrome_cookies('https://example.com')
session = requests.Session()
for k, v in cookies.items():
session.cookies.set(k, v, domain='.example.com')
It’s open source so you could theoretically pull it out and generalize it… idk if anyone wants to manage that project (seems like a ton of work even for an open source project) but I’m sure it be interesting.
[1] https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/cookies....