Merge branch 'feature/brightdata_proxy' into feature/auto_with_checkresults

This commit is contained in:
Lei PAN
2022-06-01 16:46:39 +02:00
7 changed files with 136 additions and 35 deletions
+9 -9
View File
@@ -18,6 +18,7 @@ SORRY_SENTENCE_EN = "we are extremely sorry that we were not able to fulfill"
NOT_AVAILABLE_CONTENT = "For more than 130 years, our House has offered its full expertise to satisfy"
PENDING_SENTENCE = "Ce soir, entre 20:00 et 20:30, vous obtiendrez une réponse par e-mail."
PENDING_SENTENCE_EN = "This evening between 20:00 and 20:30 you will receive a response by email."
BLANK_URL = "about:blank"
mailer = Mailer()
@@ -69,19 +70,17 @@ class ResultChecker:
proxy_username = "panleicim-res-fr-" + random_id_number
print("proxy_username is " + proxy_username)
proxy = {
"server": params.PROXY_SERVER,
"username": proxy_username,
"password": params.PROXY_PASSWORD
"server": params.BRIGHT_DATA_PROXY_SERVER,
"username": params.BRIGHT_DATA_PROXY_USERNAME,
"password": params.BRIGHT_DATA_PROXY_PASSWORD
}
while content is None:
content = self.load_page(self.tls.playwright, proxy, url)
random_id_number = params.get_random_id_number_for_proxy()
proxy_username = "panleicim-res-fr-" + random_id_number
print("proxy_username is " + proxy_username)
proxy = {
"server": params.PROXY_SERVER,
"username": proxy_username,
"password": params.PROXY_PASSWORD
"server": params.BRIGHT_DATA_PROXY_SERVER,
"username": params.BRIGHT_DATA_PROXY_USERNAME,
"password": params.BRIGHT_DATA_PROXY_PASSWORD
}
print(content)
self.browser.close()
@@ -129,7 +128,8 @@ if __name__ == '__main__':
for reserve in result_list:
count = count + 1
if reserve.accepted is None or ResultEnum.ACCEPTED.value == reserve.accepted:
executor.submit(ResultChecker().run, reserve, collection)
if reserve.url != BLANK_URL:
executor.submit(ResultChecker().run, reserve, collection)
else:
print("status is " + reserve.accepted)