can run exe file
This commit is contained in:
+4
-4
@@ -43,7 +43,7 @@ while True:
|
||||
print(event)
|
||||
print(values)
|
||||
if event == "submit":
|
||||
try:
|
||||
# try:
|
||||
start_line = int(values[KEY_START_NUMBER])
|
||||
end_line = int(values[KEY_END_NUMBER])
|
||||
max_workers = int(values[KEY_MAX_WORKERS])
|
||||
@@ -55,9 +55,9 @@ while True:
|
||||
elif values[KEY_SEVRES]:
|
||||
store_type = 3
|
||||
start_book(start_line, end_line, store_choose_state=store_type, max_workers=max_workers)
|
||||
except Exception as error:
|
||||
print("Not Integer: ")
|
||||
print(error)
|
||||
# except Exception as error:
|
||||
# print("Not Integer: ")
|
||||
# print(error)
|
||||
|
||||
elif event == "Exit" or event == sg.WIN_CLOSED:
|
||||
break
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['appointment.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='appointment',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
import shutil
|
||||
shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\appointment.json', '{0}/application.json'.format(DISTPATH))
|
||||
shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH))
|
||||
shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\config.ini', '{0}/config.ini'.format(DISTPATH))
|
||||
@@ -0,0 +1,4 @@
|
||||
[DEFAULT]
|
||||
contact_list_file = C:\Users\landd\IdeaProjects\appointment_tool\contact_all.xlsx
|
||||
firebase_config_file = C:/Users/landd/IdeaProjects/appointment_tool/appointment.json
|
||||
LOGS_DIR = C:/Users/landd/IdeaProjects/appointment_tool/
|
||||
+3
-4
@@ -2,11 +2,10 @@ import datetime
|
||||
import firebase_admin
|
||||
import xlsxwriter as xlsxwriter
|
||||
from firebase_admin import credentials, firestore
|
||||
|
||||
import definitions
|
||||
import params
|
||||
from pojo.MailPojo import MailPojo
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo, PublishType
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo
|
||||
from pojo.SimInfoPojo import SimInfoPojo
|
||||
from pojo.contact_pojo import ContactPojo
|
||||
from utils.excel_reader import ExcelHelper
|
||||
@@ -25,10 +24,9 @@ class DataManager:
|
||||
batch_size = 20
|
||||
|
||||
def __init__(self):
|
||||
cred = credentials.Certificate(definitions.ROOT_DIR + "/appointment.json")
|
||||
cred = credentials.Certificate(definitions.FIREBASE_CONFIG_FILE)
|
||||
self._app = firebase_admin.initialize_app(cred)
|
||||
self._db = firestore.client()
|
||||
self._contact_list = excel_reader.read_contacts("/contact_all.xlsx")
|
||||
|
||||
def get_all_error_items(self):
|
||||
pass
|
||||
@@ -88,6 +86,7 @@ class DataManager:
|
||||
## 读取数据库中的sim卡信息,然后写到sim_infos.xlsx文件中
|
||||
def save_to_excel(self):
|
||||
# Start from the first cell. Rows and columns are zero indexed.
|
||||
self._contact_list = excel_reader.read_contacts()
|
||||
sim_info_list = []
|
||||
for sim in self.get_all_sim_infos().stream():
|
||||
print(sim)
|
||||
|
||||
+6
-4
@@ -1,10 +1,12 @@
|
||||
import configparser
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
import getpass
|
||||
config = configparser.ConfigParser()
|
||||
config.read('./config.ini')
|
||||
CONTACT_LIST_FILE = config['DEFAULT']['contact_list_file']
|
||||
FIREBASE_CONFIG_FILE = config['DEFAULT']['firebase_config_file']
|
||||
LOGS_DIR = config['DEFAULT']['LOGS_DIR']
|
||||
username = getpass.getuser()
|
||||
load_dotenv()
|
||||
|
||||
LOG_SOURCE = username
|
||||
SMS_TIMEOUT = 120
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
import definitions
|
||||
from definitions import LOGS_DIR
|
||||
|
||||
|
||||
def init_logger():
|
||||
logging.basicConfig(filename=definitions.ROOT_DIR + "/appointment_{}.log".format(str(datetime.date.today())),
|
||||
logging.basicConfig(filename=LOGS_DIR + "/appointment_{}.log".format(str(datetime.date.today())),
|
||||
filemode='a',
|
||||
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S',
|
||||
|
||||
@@ -8,7 +8,6 @@ from utils.excel_reader import ExcelHelper
|
||||
from workers.commandor_page import CommandorPage
|
||||
|
||||
# used to save the current slot position
|
||||
|
||||
init_logger()
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(logging.StreamHandler(stream=sys.stdout))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import configparser
|
||||
|
||||
from db.DbManager import DataManager
|
||||
from logs.LogSender import LogSender
|
||||
|
||||
|
||||
+1
-2
@@ -2,11 +2,10 @@ dataclasses_json==0.5.6
|
||||
firebase_admin==5.2.0
|
||||
pandas==1.4.1
|
||||
playwright==1.21.0
|
||||
pyserial==3.5
|
||||
pydotenv==0.0.7
|
||||
dataclasses~=0.6
|
||||
oci~=2.54.1
|
||||
XlsxWriter~=3.0.3
|
||||
SQLAlchemy~=1.4.29
|
||||
boto3~=1.21.13
|
||||
openpyxl==3.0.9
|
||||
iniFile==0.4.1
|
||||
+20
-13
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import random
|
||||
import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@@ -10,14 +11,10 @@ import params
|
||||
from workers.commandor_page import get_random_id_number_for_proxy
|
||||
from logs.LogSender import TYPE_EVENT_CHECK_RESULTS, LOG_SUBJECT_EVENT
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo
|
||||
from utils.excel_reader import ExcelHelper
|
||||
|
||||
SORRY_SENTENCE = "nous sommes sincèrement désolés de n'avoir pu vous satisfaire cette fois-ci"
|
||||
PENDING_SENTENCE = "Ce soir, entre 20:00 et 20:30, vous obtiendrez une réponse par e-mail."
|
||||
|
||||
user_agent_list = ExcelHelper().read_user_agent_list()
|
||||
|
||||
|
||||
class ResultEnum(Enum):
|
||||
ACCEPTED = "ACCEPTED"
|
||||
REFUSED = "REFUSED"
|
||||
@@ -33,17 +30,27 @@ class Tls(threading.local):
|
||||
class Worker:
|
||||
tls = Tls()
|
||||
|
||||
def __init__(self):
|
||||
self.logger = logging.getLogger("Worker")
|
||||
|
||||
def load_page(self, browser, url, proxy) -> Union[str, None]:
|
||||
try:
|
||||
firefox_user_agents = filter(lambda user_agent: "firefox" in user_agent.lower(), user_agent_list)
|
||||
firefox_user_agents_list = list(firefox_user_agents)
|
||||
user_agent = random.choice(firefox_user_agents_list)
|
||||
page = browser.new_page(
|
||||
user_agent=user_agent,
|
||||
proxy=proxy)
|
||||
page.add_init_script("""() => Object.defineProperty(navigator,'webdriver',{get: () => undefined}""")
|
||||
page.goto(url, timeout=90000)
|
||||
return page.content()
|
||||
device = random.choice(params.DEVICES)
|
||||
self.logger.info("device is " + device)
|
||||
pixel_2 = self.tls.playwright.devices[device]
|
||||
context = browser.new_context(**pixel_2, locale='en-GB')
|
||||
self.page = context.new_page()
|
||||
# hide webdriver information
|
||||
self.page.add_init_script("""() => {
|
||||
Object.defineProperty(navigator,'webdriver',{get: () => undefined});
|
||||
Object.defineProperty(navigator, 'platform', {
|
||||
get: () => {
|
||||
return "iPhone";
|
||||
}});
|
||||
}
|
||||
""")
|
||||
self.page.goto(url, timeout=90000)
|
||||
return self.page.content()
|
||||
except Exception as error:
|
||||
print(error)
|
||||
return None
|
||||
|
||||
+3
-53
@@ -3,10 +3,8 @@ import json
|
||||
import pandas as pandas
|
||||
|
||||
import definitions
|
||||
import params
|
||||
from pojo.SimInfoPojo import SimInfoPojo
|
||||
from definitions import CONTACT_LIST_FILE
|
||||
from pojo.contact_pojo import ContactPojo
|
||||
from utils.operator import check_operator
|
||||
|
||||
|
||||
class ExcelHelper:
|
||||
@@ -19,50 +17,8 @@ class ExcelHelper:
|
||||
self._df = pandas.concat([self._df, new_df])
|
||||
self._df.to_excel(file_name)
|
||||
|
||||
def generate_exel_from_txt(self):
|
||||
f = open("../phone_list.txt")
|
||||
lines = f.read()
|
||||
self.write_to_exel("phone_list.xlsx", lines.split(","))
|
||||
ccid_file = open("../ccid_list.txt")
|
||||
ccids = ccid_file.read()
|
||||
self.write_to_exel("ccid_list.xlsx", ccids.split(","))
|
||||
print(lines)
|
||||
|
||||
def read_user_agent_list(self):
|
||||
# read the contact list from the exel file
|
||||
contact_list_in_json = pandas.read_excel(definitions.ROOT_DIR + "/docs/mobile_user_agent_list.xlsx").to_json(
|
||||
orient='records')
|
||||
contact_dict_list = json.loads(contact_list_in_json)
|
||||
user_agents = []
|
||||
for contact_dict in contact_dict_list:
|
||||
user_agent = contact_dict['user_agent']
|
||||
user_agents.append(user_agent)
|
||||
return user_agents
|
||||
|
||||
def read_sim_info(self) -> list:
|
||||
sim_info_list_in_json = pandas.read_excel(definitions.ROOT_DIR + "/docs/sim_infos.xlsx").to_json(orient='records')
|
||||
sim_info_dict_list = json.loads(sim_info_list_in_json)
|
||||
sim_info_list = []
|
||||
for contact_dict in sim_info_dict_list:
|
||||
position = contact_dict['position']
|
||||
slot_position = int(int(position) / len(params.MODEM_POOL_PORTS)) + 1
|
||||
sim_position = int(position) % len(params.MODEM_POOL_PORTS)
|
||||
ccid = contact_dict['ccid']
|
||||
operator = check_operator(ccid).name
|
||||
siminfo = SimInfoPojo(phone=contact_dict['phone'],
|
||||
name=contact_dict['name'],
|
||||
ccid=ccid,
|
||||
passport=contact_dict['passport'],
|
||||
position=contact_dict['position'],
|
||||
slot_position=slot_position,
|
||||
sim_position=sim_position,
|
||||
operator=operator,
|
||||
email=contact_dict['email'])
|
||||
sim_info_list.append(siminfo)
|
||||
return sim_info_list
|
||||
|
||||
def read_contacts(self, file_name="/contact_all.xlsx") -> list:
|
||||
contact_list_in_json = pandas.read_excel(definitions.ROOT_DIR + file_name).to_json(orient='records')
|
||||
def read_contacts(self, file_name=CONTACT_LIST_FILE) -> list:
|
||||
contact_list_in_json = pandas.read_excel(file_name).to_json(orient='records')
|
||||
contact_dict_list = json.loads(contact_list_in_json)
|
||||
contact_list = []
|
||||
for contact_dict in contact_dict_list:
|
||||
@@ -76,9 +32,3 @@ class ExcelHelper:
|
||||
mail=contact_dict['email'])
|
||||
contact_list.append(contact)
|
||||
return contact_list
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
helper = ExcelHelper()
|
||||
# helper.generate_exel_from_txt()
|
||||
print(helper.read_sim_info())
|
||||
|
||||
@@ -19,7 +19,6 @@ RDV_URL = "https://rendezvousparis.hermes.com/client/register"
|
||||
# RDV_URL = "https://api.ipify.org"
|
||||
# RDV_URL ="https://bot.sannysoft.com/"
|
||||
otp_value = None
|
||||
user_agent_list = ExcelHelper().read_user_agent_list()
|
||||
OTP_FIELD_ID = "#sms_code"
|
||||
MESSAGE_FIELD_CLASS = ".message"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user