add result_pojo.py

This commit is contained in:
2024-02-08 00:25:04 +01:00
parent de2059435e
commit 83871f8e4b
6 changed files with 32 additions and 20 deletions
+5 -4
View File
@@ -7,6 +7,7 @@ import requests
from db.mongo_manager import MONGO_STORE_MANAGER
from models.ReserveResultPojo import ReserveResultPojo, PublishType
from models.result_pojo import RequestResult
from queue_message.CookiesPublisher import CookiesPublisher
from workers.proxies_constants import PROXY_LIST_FR
@@ -43,7 +44,7 @@ class Sender:
def get_csrf(self):
pass
def send_request(self, url, contact: ContactPojo, csrf: str = None):
def send_request(self, url, contact: ContactPojo, csrf: str = None) -> RequestResult:
if csrf is None:
if self._csrf is None:
_csrf = '8Bs2dBwb-nHONOzo9Tei2CcMZglEfsRqUz8E'
@@ -86,9 +87,9 @@ class Sender:
# upload the cookie to queue
self.cookiesPublisher.publish_body(new_coolies_str)
self.cookie_str = new_coolies_str
return True
return RequestResult.SUCCESS
else:
return False
return RequestResult.BLOCKED
except Exception as Error:
print(Error)
return False
return RequestResult.PROXY_ERROR