Skip to content

Commit 671b17d

Browse files
author
Sky NSS
committed
Fit and finish
1 parent 0300573 commit 671b17d

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

pandas/io/common.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949

5050
try:
5151
import requests
52-
_PY_REQUESTS_INSTALLED = True
52+
_REQUESTS_INSTALLED = True
5353
except ImportError:
54-
_PY_REQUESTS_INSTALLED = False
54+
_REQUESTS_INSTALLED = False
5555

5656

5757
if 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-
107102
def _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

pandas/io/html.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _read(obj, http_params=None):
127127
A python dict containing:
128128
'auth': tuple (str, str) eg (unae, pwd)
129129
'auth': Any other auth object accepted by requests
130-
'verify': boolean, Default True
130+
'verify': boolean, default True
131131
If False, allow self signed and invalid SSL certs for https
132132
or
133133
A python requests.Session object if http(s) path to enable basic auth

pandas/tests/io/test_http_auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pandas as pd
33
import pandas.util.testing as tm
44

5-
if pd.io.common.is_requests_pkg_avail():
5+
if pd.io.common._REQUESTS_INSTALLED:
66
from requests.packages.urllib3.exceptions import InsecureRequestWarning
77
import requests
88
requests_pkg = True

0 commit comments

Comments
 (0)