8000 Make imports of http.client constants compatible with Py2.6 (issue #137) · thecodingchicken/python-future@7606626 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7606626

Browse files
committed
Make imports of http.client constants compatible with Py2.6 (issue PythonCharmers#137)
1 parent e7316ab commit 7606626

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/http/client.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,22 @@
7070
NOT_EXTENDED,
7171

7272
MAXAMOUNT,
73-
_MAXLINE,
74-
_MAXHEADERS,
75-
_is_legal_header_name,
76-
_is_illegal_header_value,
77-
_METHODS_EXPECTING_BODY,
78-
79-
LineTooLong,
80-
LineAndFileWrapper,
8173
)
74+
75+
# These are not available on Python 2.6.x:
76+
try:
77+
from httplib import LineTooLong, LineAndFileWrapper
78+
except ImportError:
79+
pass
80+
81+
# These may not be available on all versions of Python 2.6.x or 2.7.x
82+
try:
83+
from httplib import (
84+
_MAXLINE,
85+
_MAXHEADERS,
86+
_is_legal_header_name,
87+
_is_illegal_header_value,
88+
_METHODS_EXPECTING_BODY
89+
)
90+
except ImportError:
91+
pass

0 commit comments

Comments
 (0)
0