2323from webdriver_manager .core .http import HttpClient
2424from webdriver_manager .core .os_manager import OperationSystemManager
2525
26- __version__ = "0.0.3 "
26+ __version__ = "0.0.5 "
2727
2828DEFAULT_CACHE_DIR = os .path .join (Path .home (), ".html2print" , "chromedriver" )
2929
@@ -40,7 +40,7 @@ def get(self, url, params=None, **kwargs) -> Response:
4040 last_error : Optional [Exception ] = None
4141 for attempt in range (1 , 3 ):
4242 print ( # noqa: T201
43- f"html2pdf : sending GET request attempt { attempt } : { url } "
43+ f"html2print : sending GET request attempt { attempt } : { url } "
4444 )
4545 try :
4646 return requests .get (url , params , timeout = (5 , 5 ), ** kwargs )
@@ -50,10 +50,10 @@ def get(self, url, params=None, **kwargs) -> Response:
5050 last_error = read_timeout_
5151 except Exception as exception_ :
5252 raise AssertionError (
53- "html2pdf : unknown exception" , exception_
53+ "html2print : unknown exception" , exception_
5454 ) from None
5555 print ( # noqa: T201
56- f"html2pdf : "
56+ f"html2print : "
5757 f"failed to get response for URL: { url } with error: { last_error } "
5858 )
5959
@@ -83,24 +83,24 @@ def find_driver(self, driver: Driver):
8383 )
8484 if os .path .isfile (path_to_cached_chrome_driver ):
8585 print ( # noqa: T201
86- f"html2pdf : ChromeDriver exists in the local cache: "
86+ f"html2print : ChromeDriver exists in the local cache: "
8787 f"{ path_to_cached_chrome_driver } "
8888 )
8989 return path_to_cached_chrome_driver
9090 print ( # noqa: T201
91- f"html2pdf : ChromeDriver does not exist in the local cache: "
91+ f"html2print : ChromeDriver does not exist in the local cache: "
9292 f"{ path_to_cached_chrome_driver } "
9393 )
9494 path_to_downloaded_chrome_driver = super ().find_driver (driver )
9595 if path_to_downloaded_chrome_driver is None :
9696 print ( # noqa: T201
97- f"html2pdf : could not get a downloaded ChromeDriver: "
97+ f"html2print : could not get a downloaded ChromeDriver: "
9898 f"{ path_to_cached_chrome_driver } "
9999 )
100100 return None
101101
102102 print ( # noqa: T201
103- f"html2pdf : saving chromedriver to StrictDoc's local cache: "
103+ f"html2print : saving chromedriver to StrictDoc's local cache: "
104104 f"{ path_to_downloaded_chrome_driver } -> { path_to_cached_chrome_driver } "
105105 )
106106 Path (path_to_cached_chrome_driver_dir ).mkdir (
@@ -116,7 +116,7 @@ def get_inches_from_millimeters(mm: float) -> float:
116116
117117
118118def get_pdf_from_html (driver , url ) -> bytes :
119- print (f"html2pdf : opening URL with ChromeDriver: { url } " ) # noqa: T201
119+ print (f"html2print : opening URL with ChromeDriver: { url } " ) # noqa: T201
120120
121121 driver .get (url )
122122
@@ -170,7 +170,7 @@ class Done(Exception):
170170 )
171171 sys .exit (1 )
172172
173- print ("html2pdf : JS logs from the print session:" ) # noqa: T201
173+ print ("html2print : JS logs from the print session:" ) # noqa: T201
174174 print ('"""' ) # noqa: T201
175175 for entry in logs :
176176 print (entry ) # noqa: T201
@@ -179,7 +179,7 @@ class Done(Exception):
179179 #
180180 # Execute Print command with ChromeDriver.
181181 #
182- print ("html2pdf : executing print command with ChromeDriver." ) # noqa: T201
182+ print ("html2print : executing print command with ChromeDriver." ) # noqa: T201
183183 result = driver .execute_cdp_cmd ("Page.printToPDF" , calculated_print_options )
184184
185185 data = base64 .b64decode (result ["data" ])
@@ -205,7 +205,7 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
205205 path_to_chrome = get_chrome_driver (path_to_cache_dir )
206206 else :
207207 path_to_chrome = chromedriver
208- print (f"html2pdf : ChromeDriver available at path: { path_to_chrome } " ) # noqa: T201
208+ print (f"html2print : ChromeDriver available at path: { path_to_chrome } " ) # noqa: T201
209209
210210 service = Service (path_to_chrome )
211211
@@ -223,7 +223,7 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
223223 # Enable the capturing of everything in JS console.
224224 webdriver_options .set_capability ("goog:loggingPrefs" , {"browser" : "ALL" })
225225
226- print ("html2pdf : creating ChromeDriver." , flush = True ) # noqa: T201
226+ print ("html2print : creating ChromeDriver." , flush = True ) # noqa: T201
227227
228228 driver = webdriver .Chrome (
229229 options = webdriver_options ,
@@ -295,7 +295,7 @@ def main():
295295 )
296296
297297 path_to_chrome = get_chrome_driver (path_to_cache_dir )
298- print (f"html2pdf : ChromeDriver available at path: { path_to_chrome } " ) # noqa: T201
298+ print (f"html2print : ChromeDriver available at path: { path_to_chrome } " ) # noqa: T201
299299 sys .exit (0 )
300300
301301 elif args .command == "print" :
@@ -310,13 +310,13 @@ def main():
310310
311311 @atexit .register
312312 def exit_handler ():
313- print ("html2pdf : exit handler: quitting the ChromeDriver." ) # noqa: T201
313+ print ("html2print : exit handler: quitting the ChromeDriver." ) # noqa: T201
314314 driver .quit ()
315315
316316 assert len (paths ) % 2 == 0 , (
317317 f"Expecting an even number of input/output path arguments: { paths } ."
318318 )
319- for current_pair_idx in range (0 , 2 , len (paths )):
319+ for current_pair_idx in range (0 , len (paths ), 2 ):
320320 path_to_input_html = paths [current_pair_idx ]
321321 path_to_output_pdf = paths [current_pair_idx + 1 ]
322322
@@ -331,7 +331,7 @@ def exit_handler():
331331 with open (path_to_output_pdf , "wb" ) as f :
332332 f .write (pdf_bytes )
333333 else :
334- print ("html2pdf : unknown command." ) # noqa: T201
334+ print ("html2print : unknown command." ) # noqa: T201
335335 sys .exit (1 )
336336
337337
0 commit comments