Set session params instead of headers

This commit is contained in:
Matthias
2024-05-20 14:44:25 +02:00
parent 5fd76a79fe
commit 8d1285bb21

View File

@@ -16,9 +16,10 @@ class FtCoinGeckoApi(CoinGeckoAPI):
# Doint' pass api_key to parent, instead set the header on the session directly
self._api_key = api_key
if api_key and not is_demo:
self.api_base_url = self.__PRO_API_URL_BASE
self.session.headers.update({"x-cg-pro-api-key": api_key})
else:
if api_key and is_demo:
# Use demo api key
self.api_base_url = self.__API_URL_BASE
self.session.headers.update({"x-cg-demo-api-key": api_key})
self.session.params.update({"x_cg_demo_api_key": api_key})
else:
self.api_base_url = self.__PRO_API_URL_BASE
self.session.params.update({"x_cg_pro_api_key": api_key})