Skip to content

Commit

Permalink
Update client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
uNickz committed Dec 23, 2023
1 parent 79b8eec commit a41dfdf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WebSite2PDF/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def pdf(self, url: Union[str, Iterable[str]], filename: Optional[Union[str, Iter

self.client.driver.execute_script("window.print();")
__file_path = os.path.join(os.getcwd(), "WebSite2PDF.pdf")
while not os.path.isfile(__file_path):
while not os.path.isfile(__file_path) or os.path.getsize(__file_path) == 0:
time.sleep(0.1)
self.client.stop_client()
if isinstance(filename, list):
Expand All @@ -95,7 +95,7 @@ def pdf(self, url: Union[str, Iterable[str]], filename: Optional[Union[str, Iter
else:
self.client.driver.execute_script("window.print();")
__file_path = os.path.join(os.getcwd(), "WebSite2PDF.pdf")
while not os.path.isfile(__file_path):
while not os.path.isfile(__file_path) or os.path.getsize(__file_path) == 0:
time.sleep(0.1)
with open(__file_path, "rb") as file:
__gresp += [file.read()]
Expand Down Expand Up @@ -125,7 +125,7 @@ def pdf(self, url: Union[str, Iterable[str]], filename: Optional[Union[str, Iter
else:
self.client.driver.execute_script("window.print();")
__file_path = os.path.join(os.getcwd(), "WebSite2PDF.pdf")
while not os.path.isfile(__file_path):
while not os.path.isfile(__file_path) or os.path.getsize(__file_path) == 0:
time.sleep(0.1)
os.rename(__file_path, __fn)
__gresp += [os.path.abspath(__fn)]
Expand Down

0 comments on commit a41dfdf

Please sign in to comment.