def __ssl_version(self, try_next=False):
"""
Returns an SSL Context Object while handling the many
supported protocols
"""
if try_next:
# Increment version
self.secure_protocol_idx += 1
while self.secure_protocol_idx < len(SECURE_PROTOCOL_PRIORITY):
# Now return it
return SECURE_PROTOCOL_PRIORITY[self.secure_protocol_idx][0]
# If we reach here, we had a problem; use SocketRetryLimit() instead
# of SocketException() since we're at the end of the line now.
raise SocketRetryLimit('There are no protocols left to try.')
评论列表
文章目录