summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-26 16:32:26 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-26 16:32:26 (GMT)
commit2442015af26321083d4a2d75c096c8b732f049b2 (patch)
tree24cb8bc1fd46815ecc6e795cfcc008e7a576c672 /Lib/urllib2.py
parent744c2cd32585c1aeb1b78063cc6dda740d59c0c0 (diff)
downloadcpython-2442015af26321083d4a2d75c096c8b732f049b2.zip
cpython-2442015af26321083d4a2d75c096c8b732f049b2.tar.gz
cpython-2442015af26321083d4a2d75c096c8b732f049b2.tar.bz2
Create http package. #2883.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index f87d364..948c6c3 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -89,7 +89,7 @@ f = urllib2.urlopen('http://www.python.org/')
import base64
import hashlib
-import httplib
+import http.client
import io
import mimetools
import os
@@ -441,7 +441,7 @@ def build_opener(*handlers):
default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
HTTPDefaultErrorHandler, HTTPRedirectHandler,
FTPHandler, FileHandler, HTTPErrorProcessor]
- if hasattr(httplib, 'HTTPS'):
+ if hasattr(http.client, 'HTTPS'):
default_classes.append(HTTPSHandler)
skip = set()
for klass in default_classes:
@@ -1047,7 +1047,7 @@ class AbstractHTTPHandler(BaseHandler):
def do_open(self, http_class, req):
"""Return an addinfourl object for the request, using http_class.
- http_class must implement the HTTPConnection API from httplib.
+ http_class must implement the HTTPConnection API from http.client.
The addinfourl return value is a file-like object. It also
has methods and attributes including:
- info(): return a mimetools.Message object for the headers
@@ -1082,7 +1082,7 @@ class AbstractHTTPHandler(BaseHandler):
# object initialized properly.
# XXX Should an HTTPResponse object really be passed to
- # BufferedReader? If so, we should change httplib to support
+ # BufferedReader? If so, we should change http.client to support
# this use directly.
# Add some fake methods to the reader to satisfy BufferedReader.
@@ -1101,23 +1101,23 @@ class AbstractHTTPHandler(BaseHandler):
class HTTPHandler(AbstractHTTPHandler):
def http_open(self, req):
- return self.do_open(httplib.HTTPConnection, req)
+ return self.do_open(http.client.HTTPConnection, req)
http_request = AbstractHTTPHandler.do_request_
-if hasattr(httplib, 'HTTPS'):
+if hasattr(http.client, 'HTTPS'):
class HTTPSHandler(AbstractHTTPHandler):
def https_open(self, req):
- return self.do_open(httplib.HTTPSConnection, req)
+ return self.do_open(http.client.HTTPSConnection, req)
https_request = AbstractHTTPHandler.do_request_
class HTTPCookieProcessor(BaseHandler):
def __init__(self, cookiejar=None):
- import cookielib
+ import http.cookiejar
if cookiejar is None:
- cookiejar = cookielib.CookieJar()
+ cookiejar = http.cookiejar.CookieJar()
self.cookiejar = cookiejar
def http_request(self, request):