cleanup styles a bit
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent ab84f9b · Browse files · 1 file·+11 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+11 added−28 removed
- other:+11 added−28 removed
Provenance
- Commit
74609c5- Tree
caec3ae- Author
Kenneth Reitz <me@kennethreitz.org>- Committer
Kenneth Reitz <me@kennethreitz.org>- Parent
ab84f9b
1 file changed+11 added−28 removed
modified:requests/models.py+11 added-28 removed
146 unmodified lines147 fdata = fp148 else:149 fdata = fp.read()150 151- rf = RequestField(name=k, data=fdata,152- filename=fn, headers=fh)151+ rf = RequestField(name=k, data=fdata, filename=fn, headers=fh)152 rf.make_multipart(content_type=ft)153 new_fields.append(rf)154 155 body, content_type = encode_multipart_formdata(new_fields)48 unmodified lines204 >>> req.prepare()205 <PreparedRequest [GET]>206 207 """209- def __init__(self,210- method=None,211- url=None,212- headers=None,213- files=None,214- data=None,215- params=None,216- auth=None,217- cookies=None,218- hooks=None,219- json=None):208+ def __init__(self, method=None, url=None, headers=None, files=None,209+ data=None, params=None, auth=None, cookies=None, hooks=None, json=None):210 211 # Default empty dicts for dict params.212 data = [] if data is None else data213 files = [] if files is None else files70 unmodified lines284 #: dictionary of callback hooks, for internal usage.285 self.hooks = default_hooks()286 287 def prepare(self, method=None, url=None, headers=None, files=None,298- data=None, params=None, auth=None, cookies=None, hooks=None,299- json=None):288+ data=None, params=None, auth=None, cookies=None, hooks=None, json=None):289 """Prepares the entire request with the given parameters."""290 291 self.prepare_method(method)292 self.prepare_url(url, params)293 self.prepare_headers(headers)294 self.prepare_cookies(cookies)295 self.prepare_body(data, files, json)296 self.prepare_auth(auth, url)297+298 # Note that prepare_auth must be last to enable authentication schemes299 # such as OAuth to work on a fully prepared request.300 301 # This MUST go after prepare_auth. Authenticators could add a hook43 unmodified lines345 except LocationParseError as e:346 raise InvalidURL(*e.args)347 348 if not scheme:359- raise MissingSchema("Invalid URL {0!r}: No schema supplied. "360- "Perhaps you meant http://{0}?".format(361- to_native_string(url, 'utf8')))349+ error = ("Invalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?")350+ error = error.format(to_native_string(url, 'utf8'))351 352+ raise MissingSchema(error)353+354 if not host:355 raise InvalidURL("Invalid URL %r: No host supplied" % url)356 357 # Only want to apply IDNA to the hostname164 unmodified lines522 server's response to an HTTP request.523 """524 525 __attrs__ = [535- '_content',536- 'status_code',537- 'headers',538- 'url',539- 'history',540- 'encoding',541- 'reason',542- 'cookies',543- 'elapsed',544- 'request',526+ '_content', 'status_code', 'headers', 'url', 'history',527+ 'encoding', 'reason', 'cookies', 'elapsed', 'request'528 ]529 530 def __init__(self):531 super(Response, self).__init__()306 unmodified lines