From 1c395ab10c1ebca12a15787b4770895852b7d037 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 27 Jun 2020 15:01:16 -0700 Subject: [PATCH] Patch SameSite support into cookies * Python 2.7 is missing SameSite cookie attribute --- plexpy/webauth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plexpy/webauth.py b/plexpy/webauth.py index 8af5638f..54ea7a0c 100644 --- a/plexpy/webauth.py +++ b/plexpy/webauth.py @@ -41,6 +41,13 @@ else: from plexpy.users import Users, refresh_users from plexpy.plextv import PlexTV +# Monkey patch SameSite support into cookies. +# https://stackoverflow.com/a/50813092 +try: + from http.cookies import Morsel +except ImportError: + from Cookie import Morsel +Morsel._reserved[str('samesite')] = str('SameSite') JWT_ALGORITHM = 'HS256' JWT_COOKIE_NAME = 'tautulli_token_'