4949
5050try :
5151 import requests
52- _PY_REQUESTS_INSTALLED = True
52+ _REQUESTS_INSTALLED = True
5353except ImportError :
54- _PY_REQUESTS_INSTALLED = False
54+ _REQUESTS_INSTALLED = False
5555
5656
5757if compat .PY3 :
@@ -99,11 +99,6 @@ def __next__(self):
9999 BaseIterator .next = lambda self : self .__next__ ()
100100
101101
102- def is_requests_pkg_avail ():
103- """Checks if 'python-requests' package is already installed."""
104- return _PY_REQUESTS_INSTALLED
105-
106-
107102def _is_url (url ):
108103 """Check to see if a URL has a valid protocol.
109104
@@ -228,9 +223,9 @@ def fetch_url(url, http_params=None, skip_requests=False):
228223
229224 http_params : dict or requests.Session(), default None
230225 A python dict containing:
231- 'auth': tuple (str, str) eg (unae, pwd )
226+ 'auth': tuple (str, str) eg (username, password )
232227 'auth': Any other auth object accepted by requests
233- 'verify': boolean, Default True
228+ 'verify': boolean, default True
234229 If False, allow self signed and invalid SSL cert for https
235230 or
236231 A python requests.Session object if http(s) path to enable basic auth
@@ -249,14 +244,14 @@ def fetch_url(url, http_params=None, skip_requests=False):
249244 if not http_params :
250245 skip_requests = True
251246 if (not skip_requests ) and \
252- is_requests_pkg_avail () and \
247+ _REQUESTS_INSTALLED and \
253248 _is_handled_by_requests (url ):
254249 s = gen_session (http_params )
255250 resp = s .get (url )
256251 resp .raise_for_status ()
257252 content_bytes = resp .content
258253 else :
259- if http_params and (skip_requests or not is_requests_pkg_avail () ):
254+ if http_params and (skip_requests or not _REQUESTS_INSTALLED ):
260255 msg = 'To utilize http_params, python-requests library is ' + \
261256 'required but not detected'
262257 raise ValueError (msg )
@@ -285,7 +280,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
285280 A python dict containing:
286281 'auth': tuple (str, str) eg (unae, pwd)
287282 'auth': Any other auth object accepted by requests
288- 'verify': boolean, Default True
283+ 'verify': boolean, default True
289284 If False, allow self signed and invalid SSL cert for https
290285 or
291286 A python requests.Session object if http(s) path to enable basic auth
0 commit comments