Merge branch 'feature/automatic' into feature/auto_with_checkresults

This commit is contained in:
Lei PAN
2022-06-08 09:57:50 +02:00
7 changed files with 26 additions and 14 deletions
+6 -1
View File
@@ -30,6 +30,7 @@ class ReserveResultPojo:
sim_position = None
ccid: str = ""
source_from: str = definitions.LOG_SOURCE
store_type = 0
@staticmethod
def from_firestore_dict(source):
@@ -62,6 +63,9 @@ class ReserveResultPojo:
if 'ccid' in source:
ccid = source['ccid']
result.ccid = ccid
if 'store_type' in source:
store_type = source['store_type']
result.store_type = store_type
result.id = id
return result
@@ -79,7 +83,8 @@ class ReserveResultPojo:
u'sim_position': self.sim_position,
u'slot_position': self.slot_position,
u'ccid': self.ccid,
u'source_from': self.source_from
u'source_from': self.source_from,
u'store_type': self.store_type,
}
return dest
+4 -3
View File
@@ -7,8 +7,9 @@ import xlsxwriter
from definitions import CONTACT_LIST_FILE
from pojo.contact_pojo import ContactPojo
from utils.generate_random_passport_id import get_random_passport_id_number
phone_number_prefix = ['6', '7']
phone_number_prefix = ['6']
class ExcelHelper:
@@ -122,7 +123,7 @@ def write_new_contacts_to_excel(valid_contacts: list):
row = row + 1
for info in valid_contacts:
info.phone = get_random_phone_numbers()
info.passport = get_random_id_number()
info.passport = get_random_passport_id_number()
info.mail = generate_email_from_name(info.first_name, info.last_name)
# Iterate over the data and write it out row by row.
worksheet.write(row, col, "{} {}".format(info.last_name, info.first_name))
@@ -135,6 +136,6 @@ def write_new_contacts_to_excel(valid_contacts: list):
if __name__ == '__main__':
excel_reader = ExcelHelper()
contacts = excel_reader.read_names("C:/Users/landd/Downloads/names.xlsx")
contacts = excel_reader.read_names("C:/Users/landd/Desktop/rdv/08-06/500.xlsx")
print(contacts)
write_new_contacts_to_excel(valid_contacts=contacts)
+1 -1
View File
@@ -19,7 +19,7 @@ def get_random_id_number() -> str:
def write_the_valid_profiles_to_excel():
day_list = ['2022-05-30']
day_list = ['2022-06-02']
collection = []
for day in day_list:
+8 -5
View File
@@ -1,8 +1,11 @@
import random
import string
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7',
'8', '9']
# letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7',
# '8', '9']
letters = ['E', 'G', 'M']
def get_random_id_number() -> str:
@@ -11,11 +14,11 @@ def get_random_id_number() -> str:
id_number = str(ran)
return id_number
# 产生中国护照号
def get_random_passport_id_number() -> str:
S = 7 # number of characters in the string.
S = 8 # number of characters in the string.
ran = ''.join(random.choices(string.digits, k=S))
id_number = "E" + random.choice(letters) + str(ran)
id_number = random.choice(letters) + str(ran)
return id_number
+1 -1
View File
@@ -13,7 +13,7 @@ def generate_names() -> list:
if __name__ == '__main__':
for i in range(0, 5):
for i in range(0, 500):
names = generate_names()
for name in names:
print(name)
Binary file not shown.
+5 -2
View File
@@ -26,7 +26,7 @@ REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0
otp_value = None
OTP_FIELD_ID = "#sms_code"
MESSAGE_FIELD_CLASS = ".message"
BLANK_URL = "about:blank"
CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
DOUBLE_REQUEST_ERROR_MESSAGE = "A request with the same data has already been validated today."
@@ -55,7 +55,7 @@ class CommandorPage:
def __init__(self, contact: ContactPojo, store_type=0, proxy_type=0, mode: ModeEnum = ModeEnum.MANUAL):
self.otp_value = None
self.logger = logging.getLogger("CommandorPage:" + str(contact.phone))
self.logger = logging.getLogger("约会页面:" + str(contact.phone))
self.is_finished = False
self.contact = contact
self.proxy_type = proxy_type
@@ -235,6 +235,8 @@ class CommandorPage:
def get_errors(self):
# send error result
if self.page.url != BLANK_URL:
# no need to push blank url to db
self.publish_message_to_queue(self.contact, PublishType.ERROR, self.page.url)
try:
items = self.page.query_selector("div.alert")
@@ -330,6 +332,7 @@ class CommandorPage:
firstName=contact.first_name, lastName=contact.last_name, email=contact.mail,
passport=contact.passport, ccid=contact.ccid)
result.id = id
result.store_type = self.store_type
params.firebase_store_manager.save(result)
if status is PublishType.SUCCESS:
self.on_success(result)