Skip to content
Myr

Add DeprecationWarnings to inform users of plans

Before adoption: this commit came in with the history the project adopted, so no landing records it.

After a long discussion in IRC and on several issues, the developers of requests have decided to remove specific functions from requests.utils in version 3.0.0. To give users ample time to prepare for this, we've added DeprecationWarnings long in advance. See also the planning of this in issue #2266.

authored by Ian Cordasco · committed by Ian Cordasco · parent be805f9 · Browse files · 1 file+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−0 removed

  • other:+11 added−0 removed

1 file+11 added−0 removed

modified:requests/utils.py+11 added
17 unmodified lines
18import re19import sys20import socket21import struct22import warnings2324from . import __version__25from . import certs26from .compat import parse_http_list as _parse_list_header
260 unmodified lines
287 """Returns encodings from given content string.288289 :param content: bytestring to extract encodings from.290 """291 warnings.warn((292 'In requests 3.0, get_encodings_from_content will be removed. For '293 'more information, please see the discussion on issue #2266. (This'294 ' warning should only appear once.)'),295 DeprecationWarning)296297 charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)298 pragma_re = re.compile(r'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)299 xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
59 unmodified lines
359 1. charset from content-type360 2. fall back and replace all unicode characters361362 """363 warnings.warn((364 'In requests 3.0, get_unicode_from_response will be removed. For '365 'more information, please see the discussion on issue #2266. (This'366 ' warning should only appear once.)'),367 DeprecationWarning)368369 tried_encodings = []370371 # Try charset from content-type
326 unmodified lines