contact-person-profile-csv-imp-local 0.0.37__py3-none-any.whl → 0.0.39__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py +39 -20
- {contact_person_profile_csv_imp_local-0.0.37.dist-info → contact_person_profile_csv_imp_local-0.0.39.dist-info}/METADATA +1 -1
- contact_person_profile_csv_imp_local-0.0.39.dist-info/RECORD +7 -0
- {contact_person_profile_csv_imp_local-0.0.37.dist-info → contact_person_profile_csv_imp_local-0.0.39.dist-info}/WHEEL +1 -1
- contact_person_profile_csv_imp_local-0.0.37.dist-info/RECORD +0 -7
- {contact_person_profile_csv_imp_local-0.0.37.dist-info → contact_person_profile_csv_imp_local-0.0.39.dist-info}/top_level.txt +0 -0
|
@@ -173,7 +173,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
173
173
|
# TODO Align the parameters between import-contact-csv with sync-google-contact
|
|
174
174
|
# TODO Can we please add groups_str parameter to both sync-google-contact and import-contact-csv where we add all contacts to those groups?
|
|
175
175
|
def insert_update_contact_from_csv(
|
|
176
|
-
self, *, data_source_type_id: int, file_name: str = None,
|
|
176
|
+
self, *, username: str, email_address: str, data_source_type_id: int, file_name: str = None, system_id: int = None,
|
|
177
177
|
# TODO Add support to criteria_set_id
|
|
178
178
|
directory_name: str = None, csv_path: str = None, start_index: int = 0, end_index: int = None,
|
|
179
179
|
groups_dicts: list[dict] = None, profile_id: int = None) -> dict:
|
|
@@ -196,7 +196,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
196
196
|
profile_id_by_email_address = ProfilesLocal().select_one_value_by_column_and_value(
|
|
197
197
|
schema_name="profile", view_table_name="profile_view",
|
|
198
198
|
select_clause_value="profile_id", column_name="profile.main_email_address",
|
|
199
|
-
column_value=
|
|
199
|
+
column_value=email_address)
|
|
200
200
|
system_id = system_id or CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
|
|
201
201
|
self.set_schema(schema_name="field")
|
|
202
202
|
profile_id = profile_id or profile_id_by_email_address
|
|
@@ -229,13 +229,13 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
229
229
|
'address1_country', 'address2_street', 'address2_city', 'address2_state', 'address2_postal_code',
|
|
230
230
|
'address2_country', 'job_title', 'organization', 'display_as')
|
|
231
231
|
|
|
232
|
-
user_external_id = self.__get_user_external_id(user_external_username=
|
|
232
|
+
user_external_id = self.__get_user_external_id(user_external_username=username,
|
|
233
233
|
profile_id=profile_id, system_id=system_id)
|
|
234
234
|
# We create a new data_source_instance_id everytime we import a new csv file
|
|
235
235
|
data_source_instance_id = self.__get_data_source_instance_id(
|
|
236
236
|
data_source_type_id=data_source_type_id, csv_file_path=csv_file_path,
|
|
237
237
|
user_external_id=user_external_id, file_name=file_name,
|
|
238
|
-
user_external_username=
|
|
238
|
+
user_external_username=username,
|
|
239
239
|
start_index=start_index, end_index=end_index
|
|
240
240
|
)
|
|
241
241
|
fields_dictonary = self.data_sources.get_fields_name_from_csv(data_source_type_id)
|
|
@@ -509,8 +509,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
509
509
|
|
|
510
510
|
def __insert_link_contact_groups(self, contact_dict: dict) -> list:
|
|
511
511
|
contact_id = contact_dict.get("contact_id")
|
|
512
|
+
# TODO groups_dicts_list
|
|
512
513
|
groups = []
|
|
513
|
-
|
|
514
|
+
linked_groups_results_list = None
|
|
514
515
|
organization = contact_dict.get("organization")
|
|
515
516
|
if organization:
|
|
516
517
|
organization_group_dict = {
|
|
@@ -538,25 +539,28 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
538
539
|
}
|
|
539
540
|
groups.append(job_title_group_dict)
|
|
540
541
|
if contact_dict.get("groups"):
|
|
542
|
+
# TODO _contacts_groups_names_list?
|
|
541
543
|
_groups = contact_dict.get("groups").split(", ")
|
|
542
544
|
for group in _groups:
|
|
543
545
|
group_dict = {
|
|
544
546
|
# table:
|
|
545
|
-
"name": group,
|
|
547
|
+
"name": group, # TODO We need to translate to English
|
|
546
548
|
"hashtag": '#' + group.upper(),
|
|
547
549
|
"main_group_type_id": self.unknown_main_group_type_id,
|
|
548
550
|
# ml table:
|
|
551
|
+
# TODO What about the lang_code?
|
|
549
552
|
"is_main_title": False,
|
|
550
|
-
"title
|
|
553
|
+
"title": group,
|
|
551
554
|
}
|
|
552
555
|
groups.append(group_dict)
|
|
553
556
|
for group in self.groups_list:
|
|
554
557
|
groups.append(group)
|
|
555
558
|
if len(groups) > 0:
|
|
556
|
-
|
|
557
|
-
contact_id=contact_id,
|
|
559
|
+
linked_groups_results_list = self.contact_groups.insert_link_contact_group_with_group_local(
|
|
560
|
+
contact_id=contact_id, groups_list_of_dicts=groups)
|
|
561
|
+
contact_dict["linked_group_results_list"] = linked_groups_results_list
|
|
558
562
|
|
|
559
|
-
return
|
|
563
|
+
return linked_groups_results_list
|
|
560
564
|
|
|
561
565
|
def __insert_link_contact_persons(self, contact_dict: dict) -> dict:
|
|
562
566
|
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
@@ -621,7 +625,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
621
625
|
contact_id = contact_dict.get("contact_id")
|
|
622
626
|
contact_user_external_id = self.contact_user_external.insert_contact_and_link_to_existing_or_new_user_external(
|
|
623
627
|
contact_dict=contact_dict,
|
|
624
|
-
|
|
628
|
+
contact_email_address_str=contact_dict["email1"],
|
|
625
629
|
contact_id=contact_id,
|
|
626
630
|
system_id=contact_dict.get("system_id"),
|
|
627
631
|
user_external_dict={"username": contact_dict["email1"]}
|
|
@@ -638,22 +642,37 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
638
642
|
|
|
639
643
|
def __insert_link_contact_domains(self, contact_dict: dict) -> list[dict]:
|
|
640
644
|
contact_id = contact_dict.get("contact_id")
|
|
645
|
+
profiles_ids_list = contact_dict.get("profiles_ids_list")
|
|
641
646
|
website_count = 1
|
|
642
647
|
website_url = contact_dict.get("website" + str(website_count))
|
|
643
|
-
|
|
648
|
+
url_insert_information_list = []
|
|
644
649
|
while website_url:
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
650
|
+
if DomainLocal.is_domain(website_url):
|
|
651
|
+
domain_insert_information_dict = self.domain_local.link_contact_to_domain(
|
|
652
|
+
contact_id=contact_id, url=website_url)
|
|
653
|
+
url_insert_information_list.append(domain_insert_information_dict)
|
|
654
|
+
elif DomainLocal.is_url(website_url):
|
|
655
|
+
url_insert_information_dict = self.domain_local.link_contact_to_url(
|
|
656
|
+
contact_id=contact_id, url=website_url, profiles_ids=profiles_ids_list)
|
|
657
|
+
url_insert_information_list.append(url_insert_information_dict)
|
|
658
|
+
else:
|
|
659
|
+
self.logger.warining(f"__insert_link_contact_domains: website_url: {website_url} is not a valid domain or url")
|
|
648
660
|
website_count += 1
|
|
649
661
|
website_url = contact_dict.get("website" + str(website_count))
|
|
650
662
|
url = contact_dict.get("url")
|
|
651
663
|
if url:
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
664
|
+
if DomainLocal.is_domain(url):
|
|
665
|
+
domain_insert_information_dict = self.domain_local.link_contact_to_domain(
|
|
666
|
+
contact_id=contact_id, url=url)
|
|
667
|
+
url_insert_information_list.append(domain_insert_information_dict)
|
|
668
|
+
elif DomainLocal.is_url(url):
|
|
669
|
+
url_insert_information_dict = self.domain_local.link_contact_to_url(
|
|
670
|
+
contact_id=contact_id, url=url, profiles_ids=profiles_ids_list)
|
|
671
|
+
url_insert_information_list.append(url_insert_information_dict)
|
|
672
|
+
else:
|
|
673
|
+
self.logger.warining(f"__insert_link_contact_domains: url: {url} is not a valid domain or url")
|
|
674
|
+
|
|
675
|
+
return url_insert_information_list
|
|
657
676
|
|
|
658
677
|
def __insert_link_contact_location(self, contact_dict: dict) -> list[dict] or None:
|
|
659
678
|
contact_id = contact_dict.get("contact_id")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.39
|
|
4
4
|
Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=XSwqB1laIT-XdA6CJJMadAiZYXGNWcEWm_B7y9SEJLU,50658
|
|
2
|
+
contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=SsMFKnI7y3P_kQxH21rxKnX7H4MZlemBy5vuv_Ns_a4,1180
|
|
4
|
+
contact_person_profile_csv_imp_local-0.0.39.dist-info/METADATA,sha256=6F0QWD0J7pooK3YZUtLPqW5RWGkcLKauaq8uKZRPCJQ,1481
|
|
5
|
+
contact_person_profile_csv_imp_local-0.0.39.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
|
6
|
+
contact_person_profile_csv_imp_local-0.0.39.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
|
|
7
|
+
contact_person_profile_csv_imp_local-0.0.39.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=NWUnlpuq82R6_sGWO81QT9TNEg_eBg0TTzTiXIPxV1I,49321
|
|
2
|
-
contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=SsMFKnI7y3P_kQxH21rxKnX7H4MZlemBy5vuv_Ns_a4,1180
|
|
4
|
-
contact_person_profile_csv_imp_local-0.0.37.dist-info/METADATA,sha256=ZP7CrA6ljgw5oTtPnnzHXqHTvoFirGvFglzd1duQVfw,1481
|
|
5
|
-
contact_person_profile_csv_imp_local-0.0.37.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
6
|
-
contact_person_profile_csv_imp_local-0.0.37.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
|
|
7
|
-
contact_person_profile_csv_imp_local-0.0.37.dist-info/RECORD,,
|