Updated requests library to 2.4.1. Should fix #1915

This commit is contained in:
Bas Stottelaar
2014-09-25 13:58:06 +02:00
parent 574a76c231
commit 371401fa36
43 changed files with 2154 additions and 1417 deletions

View File

@@ -0,0 +1,22 @@
def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
try:
# Check via the official file-like-object way.
return obj.closed
except AttributeError:
pass
try:
# Check if the object is a container for another file-like object that
# gets released on exhaustion (e.g. HTTPResponse).
return obj.fp is None
except AttributeError:
pass
raise ValueError("Unable to determine whether fp is closed.")