&=dddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZdezdzZd dZd d Zd ZdS) N) NoNetwork)VERSION_NUMBERz reportbug/z (Debian)<c|stj}tdd}t j||||jS)ad Open an URL and return the content This is a helper function for :func:`open_url()`. Parameters ---------- url : str The URL to retrieve proxies : dict proxies to use timeout : int request timeout in seconds data unused Returns ------- str Content of the response z)gzip;q=1.0, deflate;q=0.9, identity;q=0.5)z User-AgentzAccept-Encoding)headersproxiestimeout)urllibrequest getproxiesUA_STRrequestsgettext)urlr r datars 4/usr/lib/python3/dist-packages/reportbug/urlutils.pyurlopenr+sQ, ..++--#"MOOG <Wgw O O O TTctj|tj}|r ||d<||d< t |||}n#tjj$r}|jdvrYd}~dSd}~wtj tjtjj f$rtt$r,}|r|ddkr|ddkrYd}~dStd}~wt$r#td tj tt"jj$r,}|jj}d |d |d |d} t| d}~wwxYw|S)a Open an URL and return the content Parameters ---------- url : str The URL to retrieve http_proxy : str HTTP proxy server URL to use for connection. By default, use the :func:`urllib.request.getproxies()` settings. timeout : int connection timeout in seconds Returns ------- str Content of the response httphttps)iiNrz http errorrrz@http_proxy environment variable must be formatted as a valid URI)filezFailed to open z (z: ))socketsetdefaulttimeoutr r r rerror HTTPErrorcodegaierrorURLErrorrOSError TypeErrorprintsysstderrrclient HTTPException __class____name__) r http_proxyr r pagexrexcexc_namemessages ropen_urlr3Ls* W%%%n''))G&$%!sGW-- < ! 6_ $ $44444  OV\6<+@ A   DG|++Q344444O  PWZWabbbb ; $!!!=)=C==8==s===   ! Ks=AE & A65A66>E 4CCAE 'EE ctjds-dtj|z}tj|dStrt j|dSdS)z Launch a web browser to view an URL Parameters ---------- url : str The URL to view Returns ------- None z#command -v xdg-open >/dev/null 2>&1z xdg-open N)ossystemshlexquote webbrowseropen)rcmds rlaunch_browserr<sd 9: ; ;EK,,, #r)NrN)Nr) http.clientrurllib.requestr urllib.errorrr7r5r'r9r exceptionsr__init__rrrr3r<rrrCs0 %$$$$$  & 4UUUUB1111hr