Hi,
I recently integrated posthog into our backend and I do not like that a posthog.capture can crash if the api key is not set even when I set posthog.disabled = True.
Traceback (most recent call last):
File "test.py", line 8, in <module>
posthog.capture("test", event="asd")
File "venv/lib/python3.12/site-packages/posthog/__init__.py", line 67, in capture
return _proxy(
^^^^^^^
File "venv/lib/python3.12/site-packages/posthog/__init__.py", line 497, in _proxy
default_client = Client(
^^^^^^^
File "venv/lib/python3.12/site-packages/posthog/client.py", line 69, in __init__
require("api_key", self.api_key, string_types)
File "venv/lib/python3.12/site-packages/posthog/client.py", line 941, in require
raise AssertionError(msg)
AssertionError: api_key must have (<class 'str'>,), got: None
To me this feels like a bug.
You can reproduce with
import posthog
posthog.disabled = True
posthog.host = "https://eu.i.posthog.com"
posthog.capture("test", event="asd")
It happens on posthog==3.8.4 and posthog==3.9.3
If you agree that this should not be default behavior when posthog.disabled is set to True I can create a PR
Hi,
I recently integrated posthog into our backend and I do not like that a
posthog.capturecan crash if the api key is not set even when I setposthog.disabled = True.To me this feels like a bug.
You can reproduce with
It happens on posthog==3.8.4 and posthog==3.9.3
If you agree that this should not be default behavior when posthog.disabled is set to True I can create a PR