export ua if exists

This commit is contained in:
2024-06-14 19:19:29 +02:00
parent eb5b672c28
commit 387a7ad538
2 changed files with 8 additions and 2 deletions
+3 -2
View File
@@ -61,7 +61,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
col = 0
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('contact_list_{}.xlsx'.format(file_name))
header_data = ['name', 'phone', 'passport', 'email', 'store', 'ip_country']
header_data = ['name', 'phone', 'passport', 'email', 'store', 'ip_country','ua']
worksheet = workbook.add_worksheet()
header_format = workbook.add_format({'bold': True})
@@ -76,6 +76,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
worksheet.write(row, col + 3, info.mail)
worksheet.write(row, col + 4, info.store)
worksheet.write(row, col + 5, info.ip_country)
worksheet.write(row, col + 6, info.ua)
row += 1
workbook.close()
@@ -143,7 +144,7 @@ if __name__ == '__main__':
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
# print("start at {}".format(datetime.datetime.now()))
generate_valid_contact_list_for_day(segment_number=2)
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
# generate_contact_from_mail_list("/Users/panlei/Downloads/邮箱及密码.xlsx")
# print("end at {}".format(datetime.datetime.now()))
# generate_all_contact_list()
# merge_contact_list_files(
+5
View File
@@ -38,6 +38,7 @@ class ReserveResultPojo:
created_at = None
validated_at = None
ip_address = None
ua = ""
def __hash__(self):
return hash("{}_{}_{}_{}_{}".format(self.mail, self.first_name, self.last_name, self.phone, self.passport))
@@ -87,11 +88,15 @@ class ReserveResultPojo:
current_ip = source['current_ip']
else:
current_ip = None
ua = ""
if 'ua' in source:
ua = source['ua']
result = ReserveResultPojo(type=publish_type, phone=phone,
url=url, mail=email,
first_name=firstName, last_name=lastName)
result.store = store
result.ua = ua
result.ip_address = current_ip
result.ip_country = ip_country
if 'accepted' in source: