Skip to content

Commit a69e99a

Browse files
committed
use the "in" operator in if statements
1 parent 5a495f8 commit a69e99a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/http/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ def putrequest(self, method, url, skip_host=False,
11981198

11991199
# remove interface scope from IPv6 address
12001200
# when used as Host header
1201-
if netloc.find('%') >= 0:
1201+
if "%" in netloc:
12021202
netloc_enc = netloc_enc[:netloc.find('%')] + b']'
12031203

12041204
self.putheader('Host', netloc_enc)
@@ -1218,10 +1218,10 @@ def putrequest(self, method, url, skip_host=False,
12181218
# As per RFC 273, IPv6 address should be wrapped with []
12191219
# when used as Host header
12201220

1221-
if host.find(':') >= 0:
1221+
if ":" in host:
12221222
# remove interface scope from IPv6 address
12231223
# when used as Host header
1224-
if host.find('%') >= 0:
1224+
if "%" in host:
12251225
host_enc = host_enc[:host.find('%')]
12261226
host_enc = b'[' + host_enc + b']'
12271227

0 commit comments

Comments
 (0)