diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-08 16:47:07 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-08 16:47:07 (GMT) |
commit | 7dc4f4bbab494f8d9200678bc7df2de89079317c (patch) | |
tree | fc534c5de025afe36501c4fa30d1ebc4eaa3cca9 /Lib/urllib/request.py | |
parent | 4f7a36f84f8180955d37aea4e8b44c4d4950d694 (diff) | |
download | cpython-7dc4f4bbab494f8d9200678bc7df2de89079317c.zip cpython-7dc4f4bbab494f8d9200678bc7df2de89079317c.tar.gz cpython-7dc4f4bbab494f8d9200678bc7df2de89079317c.tar.bz2 |
Issue #18978: Allow Request.method to be defined at the class level.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r-- | Lib/urllib/request.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 4765a94..049f48d 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -271,7 +271,8 @@ class Request: origin_req_host = request_host(self) self.origin_req_host = origin_req_host self.unverifiable = unverifiable - self.method = method + if method: + self.method = method @property def full_url(self): @@ -320,7 +321,7 @@ class Request: def get_method(self): """Return a string indicating the HTTP request method.""" - if self.method is not None: + if getattr(self, 'method', None) is not None: return self.method elif self.data is not None: return "POST" |