diff --git a/__init__.py b/__init__.py index 01c0427..a800027 100755 --- a/__init__.py +++ b/__init__.py @@ -2262,7 +2262,7 @@ def _transform_amplitude_profiles(self, amplitude_profile): profile = { "$token": self.token, "$distinct_id": amplitude_profile["user_id"], - "$ip": amplitude_profile["ip_address"], + "$ip": amplitude_profile["ip_address"] if "ip_address" in amplitude_profile else "0.0.0.0", "$properties": {**properties, **default_properties} } @@ -2285,8 +2285,8 @@ def _transform_amplitude_events(self, amplitude_event): "amplitude_id"], "$device_id": amplitude_event["device_id"], "time": int(event_dt.timestamp() * 1000), - "ip": amplitude_event["ip_address"], - "mp_country_code": amplitude_event["country"] + "ip": amplitude_event["ip_address"] if "ip_address" in amplitude_event else "0.0.0.0", + "mp_country_code": amplitude_event["country"] if "country" in amplitude_event else "Unknown" } default_properties = { @@ -2372,7 +2372,7 @@ def _transform_and_load_amplitude_data(self, extract_data_path): event.get("user_id") and event.get("amplitude_id")] unique_merge_events = self._dedupe_merge_events(merge_events) - + print("Importing %s" % filename) self.import_people(transformed_profiles) self.import_events(transformed_events, 0) self.import_events(unique_merge_events, 0)