Skip to content

Commit bfaddc6

Browse files
author
Sky NSS
committed
updated whatsnew. to attempt to use requests, url_params cannot be empty
1 parent c51db6f commit bfaddc6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/source/whatsnew/v0.21.0.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ parameters for basic auth, disable ssl strict check or even a requests.Session()
9393
.. ipython:: python
9494
import pandas as pd
9595

96-
# url_params is optional parameter
97-
df = pd.read_csv('https://uname:pwd@aa.com/bb.csv') # now url can contain username and pwd
96+
# url_params is optional parameter. If it is non-empty, it attempts to use python-requests library
97+
df = pd.read_csv('https://uname:pwd@aa.com/bb.csv', url_params= {'auth': None} ) # now url can contain username and pwd
98+
# Note - all basic auth scenarios require python-requests library
9899

99100
# Basic Auth
100101
df = pd.read_csv('https://aa.com/bb.csv', url_params={ 'auth': ('john', 'pwd') } ) # now url can contain username and pwd
@@ -128,7 +129,6 @@ parameters for basic auth, disable ssl strict check or even a requests.Session()
128129
df = pd.read_csv( 'https://aa.com/bbb.csv', url_params=s)
129130

130131

131-
132132
.. _whatsnew_0210.api_breaking:
133133

134134
Backwards incompatible API changes

pandas/io/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ def fetch_url(url, url_params=None, skip_requests=False):
246246
------
247247
ValueError if url_params specified without installed python-requests pkg
248248
"""
249-
if is_requests_pkg_avail() and \
250-
_is_handled_by_requests(url) and \
251-
(not skip_requests):
249+
if not url_params:
250+
skip_requests = True
251+
if (not skip_requests) and \
252+
is_requests_pkg_avail() and \
253+
_is_handled_by_requests(url):
252254
s = gen_session(url_params)
253255
resp = s.get(url)
254256
resp.raise_for_status()

0 commit comments

Comments
 (0)