File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- import socket
21import ssl
32import urllib .parse
43from http .client import HTTPResponse
109Hostname = str
1110Port = int
1211Endpoint = Tuple [Hostname , Port ]
13- Connection = socket . socket
12+ Connection = ssl . SSLSocket
1413
1514
1615http_pool = ConnectionPool [Endpoint , Connection ](
Original file line number Diff line number Diff line change 11import socket
2- from ipaddress import IPv4Address
3- from typing import Tuple
2+ from ipaddress import IPv4Address , IPv6Address
3+ from typing import Tuple , Union
44
55from generic_connection_pool .contrib .socket import TcpSocketConnectionManager
66from generic_connection_pool .threading import ConnectionPool
77
88Port = int
9- Endpoint = Tuple [IPv4Address , Port ]
9+ IpAddress = Union [IPv4Address , IPv6Address ]
10+ Endpoint = Tuple [IpAddress , Port ]
1011Connection = socket .socket
1112
1213
2122)
2223
2324
24- def command (addr : IPv4Address , port : int , cmd : str ) -> None :
25+ def command (addr : IpAddress , port : int , cmd : str ) -> None :
2526 with redis_pool .connection (endpoint = (addr , port ), timeout = 5.0 ) as sock :
2627 sock .sendall (cmd .encode () + b'\n ' )
2728 response = sock .recv (1024 )
You can’t perform that action at this time.
0 commit comments