Commits

Jason R. Coombs committed 1792005

Remove MethodRequest

Comments (0)

Files changed (3)

 Changes
 -------
 
+4.0
+~~~
+
+* Removed ``http.MethodRequest``. Use `backports.method_request
+  <https://pypi.python.org/pypi/backports.method_request/>`_ instead.
+
 2.1
 ~~~
 

jaraco/net/http/__init__.py

 import six
 from six.moves import urllib
 from six.moves import http_client
+from backports.method_request import Request
 
 import jaraco.util.string
 from jaraco.filesystem import set_time
 		"Return the query portion of a URL"
 		return urllib.parse.urlparse(url).query
 
-class MethodRequest(urllib.request.Request):
-	method = None
-
-	def __init__(self, *args, **kwargs):
-		"""
-		Construct a MethodRequest. Usage is the same as for
-		`urllib.request.Request` except it also takes an optional `method`
-		keyword argument. If supplied, `method` will be used instead of
-		the default.
-		"""
-		method = kwargs.pop('method', self.method)
-		urllib.request.Request.__init__(self, *args, **kwargs)
-		# write the method after __init__ as Python 3.3 overrides the value
-		self.method = method
-
-	def get_method(self):
-		return getattr(self, 'method') or urllib.request.Request.get_method(self)
-
-class HeadRequest(MethodRequest):
-	method = 'HEAD'
-
 def get_content_disposition_filename(url):
 	"""
 	Get the content disposition filename from a URL.
 
 	res = url
 	if not getattr(res, 'headers', None):
-		req = HeadRequest(url)
+		req = Request(url, method='HEAD')
 		try:
 			res = urllib.request.urlopen(req)
 		except urllib.error.URLError:
 		'requests',
 		'feedparser',
 		'six>=1.4',
+		'backports.method_request',
 	] + py26reqs,
 	extras_require = {
 	},