From aa7314e97a8a7c28f53b7e2a56fe491701c99e04 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 15 Mar 2018 11:07:09 -0400 Subject: [PATCH] python 3.6 syntax Signed-off-by: Kenneth Reitz --- requests/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requests/models.py b/requests/models.py index c6e5f40a..20c294eb 100644 --- a/requests/models.py +++ b/requests/models.py @@ -381,7 +381,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): self.prepare_hooks(hooks) def __repr__(self): - return '' % (self.method) + return f'' def copy(self): p = PreparedRequest() @@ -439,17 +439,17 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): if validate: rfc3986.normalize_uri(url) except rfc3986.exceptions.RFC3986Exception: - raise InvalidURL("Invalid URL %r: URL is imporoper." % url) + raise InvalidURL(f"Invalid URL {url!r}: URL is imporoper.") if not uri.scheme: error = ( - "Invalid URL {0!r}: No scheme supplied. Perhaps you meant http://{0}?" + "Invalid URL {!r}: No scheme supplied. Perhaps you meant http://{}?" ) error = error.format(to_native_string(url, 'utf8')) raise MissingScheme(error) if not uri.host: - raise InvalidURL("Invalid URL %r: No host supplied" % url) + raise InvalidURL(f"Invalid URL {url!r}: No host supplied") # In general, we want to try IDNA encoding the hostname if the string contains # non-ASCII characters. This allows users to automatically get the correct IDNA