File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -563,6 +563,7 @@ def clear_cache(language: Optional[List[str]] = None) -> None:
563
563
else :
564
564
print (f"No cache directory found for language { language } " )
565
565
566
+
566
567
def check_proxy (proxy : str ) -> None :
567
568
if not proxy .startswith ("https://" ) or ":" not in proxy :
568
569
sys .exit ("Error: Invalid proxy format. Expected 'https://host:port'." )
@@ -578,17 +579,20 @@ def check_proxy(proxy: str) -> None:
578
579
sock = socket .create_connection ((host , port ), timeout = 10 )
579
580
sock .close ()
580
581
except socket .timeout :
581
- sys .exit (f"Error: Proxy server { host } :{ port } connection timed out after 10 seconds." )
582
+ sys .exit (f"Error: Proxy server { host } :{ port } "
583
+ "connection timed out after 10 seconds." )
582
584
except socket .error as e :
583
585
sys .exit (f"Error: Could not connect to proxy server { host } :{ port } . Error: { e } " )
584
586
587
+
585
588
def set_proxy (proxy : str ) -> None :
586
589
check_proxy (proxy )
587
590
proxyHandler = ProxyHandler ({'http' : f'{ proxy } ' ,
588
591
'https' : f'{ proxy } ' })
589
592
opener = build_opener (proxyHandler )
590
593
install_opener (opener )
591
594
595
+
592
596
def create_parser () -> ArgumentParser :
593
597
parser = ArgumentParser (
594
598
prog = "tldr" ,
@@ -721,7 +725,7 @@ def main() -> None:
721
725
if options .color is False :
722
726
os .environ ["FORCE_COLOR" ] = "true"
723
727
724
- if options .proxy != None :
728
+ if options .proxy is not None :
725
729
set_proxy (options .proxy )
726
730
727
731
if options .update :
You can’t perform that action at this time.
0 commit comments