comparison tests/get-with-headers.py @ 30216:0c741fd6158a

py3: conditionalize httplib import The httplib library is renamed to http.client in python 3. So the import is conditionalized and a test is added in check-code to warn to use util.httplib
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 28 Jun 2016 16:01:53 +0530
parents f4b31fcd5e72
children e75463e3179f
comparison
equal deleted inserted replaced
30210:5b71a8d7f7ff 30216:0c741fd6158a
3 """This does HTTP GET requests given a host:port and path and returns 3 """This does HTTP GET requests given a host:port and path and returns
4 a subset of the headers plus the body of the result.""" 4 a subset of the headers plus the body of the result."""
5 5
6 from __future__ import absolute_import, print_function 6 from __future__ import absolute_import, print_function
7 7
8 import httplib
9 import json 8 import json
10 import os 9 import os
11 import sys 10 import sys
11
12 from mercurial import (
13 util,
14 )
15
16 httplib = util.httplib
12 17
13 try: 18 try:
14 import msvcrt 19 import msvcrt
15 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) 20 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
16 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) 21 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)