Rewrite FlareSolverr from scratch in Python + Selenium

This commit is contained in:
ngosang
2022-09-23 02:17:50 +02:00
parent 8d1ac09bf2
commit 1505595591
10 changed files with 929 additions and 0 deletions

83
src/dtos.py Normal file
View File

@@ -0,0 +1,83 @@
STATUS_OK = "ok"
STATUS_ERROR = "error"
class ChallengeResolutionResultT:
url: str = None
status: int = None
headers: list = None
response: str = None
cookies: list = None
userAgent: str = None
def __init__(self, _dict):
self.__dict__.update(_dict)
class ChallengeResolutionT:
status: str = None
message: str = None
result: ChallengeResolutionResultT = None
def __init__(self, _dict):
self.__dict__.update(_dict)
if self.result is not None:
self.result = ChallengeResolutionResultT(self.result)
class V1RequestBase(object):
# V1RequestBase
cmd: str = None
cookies: list = None
maxTimeout: int = None
proxy: dict = None
session: str = None
headers: list = None # deprecated v2.0.0, not used
userAgent: str = None # deprecated v2.0.0, not used
# V1Request
url: str = None
postData: str = None
returnOnlyCookies: bool = None
download: bool = None # deprecated v2.0.0, not used
returnRawHtml: bool = None # deprecated v2.0.0, not used
def __init__(self, _dict):
self.__dict__.update(_dict)
class V1ResponseBase(object):
# V1ResponseBase
status: str = None
message: str = None
startTimestamp: int = None
endTimestamp: int = None
version: str = None
# V1ResponseSolution
solution: ChallengeResolutionResultT = None
# hidden vars
__error_500__: bool = False
def __init__(self, _dict):
self.__dict__.update(_dict)
if self.solution is not None:
self.solution = ChallengeResolutionResultT(self.solution)
class IndexResponse(object):
msg: str = None
version: str = None
userAgent: str = None
def __init__(self, _dict):
self.__dict__.update(_dict)
class HealthResponse(object):
status: str = None
def __init__(self, _dict):
self.__dict__.update(_dict)