Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set
api_keyas well asproject_api_keyfor PostHog 6 and 7.With
posthog<9.0.0, pip can select PostHog 6.x or 7.x when another dependency constrains PostHog. Their module-levelsetup()reads onlyapi_key.Tracking.__init__sets onlyproject_api_key, soposthog.capture(...)andposthog.group_identify(...)raiseValueError("API key is required")on those versions. Whether that error stops tracking or monitoring depends on the caller, which the change does not handle. PostHog 8.x readsproject_api_keyfirst and treatsapi_keyas a deprecated alias, so setting both names keeps the same value on 8.x.Suggested fix
def __init__(self, config: Config): super().__init__(config) posthog.project_api_key = self.POSTHOG_PROJECT_API_KEY + posthog.api_key = self.POSTHOG_PROJECT_API_KEYTest the tracking path with PostHog 6.x, 7.x, and 8.x before merging.