Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable geoip for capture and decide calls by default #98

Merged
merged 19 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions posthog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
personal_api_key = None # type: str
project_api_key = None # type: str
poll_interval = 30 # type: int
geoip_disable = True # type: bool

default_client = None

Expand All @@ -30,6 +31,7 @@ def capture(
uuid=None, # type: Optional[str]
groups=None, # type: Optional[Dict]
send_feature_flags=False,
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand Down Expand Up @@ -62,6 +64,7 @@ def capture(
uuid=uuid,
groups=groups,
send_feature_flags=send_feature_flags,
geoip_disable=geoip_disable,
)


Expand All @@ -71,6 +74,7 @@ def identify(
context=None, # type: Optional[Dict]
timestamp=None, # type: Optional[datetime.datetime]
uuid=None, # type: Optional[str]
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand All @@ -95,6 +99,7 @@ def identify(
context=context,
timestamp=timestamp,
uuid=uuid,
geoip_disable=geoip_disable,
)


Expand All @@ -104,6 +109,7 @@ def set(
context=None, # type: Optional[Dict]
timestamp=None, # type: Optional[datetime.datetime]
uuid=None, # type: Optional[str]
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand All @@ -128,6 +134,7 @@ def set(
context=context,
timestamp=timestamp,
uuid=uuid,
geoip_disable=geoip_disable,
)


Expand All @@ -137,6 +144,7 @@ def set_once(
context=None, # type: Optional[Dict]
timestamp=None, # type: Optional[datetime.datetime]
uuid=None, # type: Optional[str]
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand All @@ -161,6 +169,7 @@ def set_once(
context=context,
timestamp=timestamp,
uuid=uuid,
geoip_disable=geoip_disable,
)


Expand All @@ -171,6 +180,7 @@ def group_identify(
context=None, # type: Optional[Dict]
timestamp=None, # type: Optional[datetime.datetime]
uuid=None, # type: Optional[str]
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand All @@ -196,6 +206,7 @@ def group_identify(
context=context,
timestamp=timestamp,
uuid=uuid,
geoip_disable=geoip_disable,
)


Expand All @@ -205,6 +216,7 @@ def alias(
context=None, # type: Optional[Dict]
timestamp=None, # type: Optional[datetime.datetime]
uuid=None, # type: Optional[str]
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> None
"""
Expand All @@ -230,6 +242,7 @@ def alias(
context=context,
timestamp=timestamp,
uuid=uuid,
geoip_disable=geoip_disable,
)


Expand All @@ -241,6 +254,7 @@ def feature_enabled(
group_properties={}, # type: dict
only_evaluate_locally=False, # type: bool
send_feature_flag_events=True, # type: bool
geoip_disable=None, # type: Optional[bool]
):
# type: (...) -> bool
"""
Expand All @@ -265,6 +279,7 @@ def feature_enabled(
group_properties=group_properties,
only_evaluate_locally=only_evaluate_locally,
send_feature_flag_events=send_feature_flag_events,
geoip_disable=geoip_disable,
)


Expand All @@ -276,6 +291,7 @@ def get_feature_flag(
group_properties={}, # type: dict
only_evaluate_locally=False, # type: bool
send_feature_flag_events=True, # type: bool
geoip_disable=None, # type: Optional[bool]
):
"""
Get feature flag variant for users. Used with experiments.
Expand Down Expand Up @@ -308,6 +324,7 @@ def get_feature_flag(
group_properties=group_properties,
only_evaluate_locally=only_evaluate_locally,
send_feature_flag_events=send_feature_flag_events,
geoip_disable=geoip_disable,
)


Expand All @@ -317,6 +334,7 @@ def get_all_flags(
person_properties={}, # type: dict
group_properties={}, # type: dict
only_evaluate_locally=False, # type: bool
geoip_disable=None, # type: Optional[bool]
):
"""
Get all flags for a given user.
Expand All @@ -334,6 +352,7 @@ def get_all_flags(
person_properties=person_properties,
group_properties=group_properties,
only_evaluate_locally=only_evaluate_locally,
geoip_disable=geoip_disable,
)


Expand All @@ -346,6 +365,7 @@ def get_feature_flag_payload(
group_properties={},
only_evaluate_locally=False,
send_feature_flag_events=True,
geoip_disable=None, # type: Optional[bool]
):
return _proxy(
"get_feature_flag_payload",
Expand All @@ -357,6 +377,7 @@ def get_feature_flag_payload(
group_properties=group_properties,
only_evaluate_locally=only_evaluate_locally,
send_feature_flag_events=send_feature_flag_events,
geoip_disable=geoip_disable,
)


Expand All @@ -366,6 +387,7 @@ def get_all_flags_and_payloads(
person_properties={},
group_properties={},
only_evaluate_locally=False,
geoip_disable=None, # type: Optional[bool]
):
return _proxy(
"get_all_flags_and_payloads",
Expand All @@ -374,6 +396,7 @@ def get_all_flags_and_payloads(
person_properties=person_properties,
group_properties=group_properties,
only_evaluate_locally=only_evaluate_locally,
geoip_disable=geoip_disable,
)


Expand Down Expand Up @@ -418,6 +441,7 @@ def _proxy(method, *args, **kwargs):
project_api_key=project_api_key,
poll_interval=poll_interval,
disabled=disabled,
geoip_disable=geoip_disable,
)

# always set incase user changes it
Expand Down
Loading