better error message

This commit is contained in:
Mylloon 2021-08-23 12:28:44 +02:00
parent a4772a94c6
commit 6e1b143cb6

View file

@ -16,8 +16,8 @@ class Scraper:
"redirect": "index.php" "redirect": "index.php"
} }
def errorFormat(self, code: int) -> str: def errorFormat(self, code: int, message: str = "") -> str:
return f"\Error: [{code}]" return f"\Error: [{code}]{' ' if len(message) > 0 else ''}{message}"
def connect(self): def connect(self):
session = create_scraper(browser = {"browser": "chrome", "platform": "windows"}) session = create_scraper(browser = {"browser": "chrome", "platform": "windows"})
@ -38,13 +38,12 @@ class Scraper:
return session return session
def search(self, session): def search(self, session):
link = "No link for your application was found." link = "No link for your application was found."
return link return link
def work(self): def work(self):
session = self.connect() session = self.connect()
link = self.search(session) link = self.search(session)
return link return link