From 6f77ec063e36a11ec55281c41a1a15ee07e72ed9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 14 Feb 2021 07:22:08 +0100 Subject: [PATCH] Fix cookieError on python<3.8 Only occurs in combination with api-server enabled, due to some hot-fixing starlette does. Since we load starlette at a later point, we need to replicate starlette's behaviour for now, so sameSite cookies don't create a problem. closes #4356 --- freqtrade/exchange/exchange.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index c7625b53c..2b47aa7dd 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -3,6 +3,7 @@ Cryptocurrency Exchanges support """ import asyncio +import http import inspect import logging from copy import deepcopy @@ -34,6 +35,12 @@ CcxtModuleType = Any logger = logging.getLogger(__name__) +# Workaround for adding samesite support to pre 3.8 python +# Only applies to python3.7, and only on certain exchanges (kraken) +# Replicates the fix from starlette (which is actually causing this problem) +http.cookies.Morsel._reserved["samesite"] = "SameSite" # type: ignore + + class Exchange: _config: Dict = {}