18 lines
		
	
	
		
			432 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			432 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import ssl
 | 
						|
import httpx
 | 
						|
 | 
						|
ssl_transport = httpx.AsyncHTTPTransport(http2=True)
 | 
						|
 | 
						|
# Ограничения пула соединений
 | 
						|
limits = httpx.Limits(max_connections=200, max_keepalive_connections=50)
 | 
						|
 | 
						|
# Таймауты
 | 
						|
timeout = httpx.Timeout(connect=5.0, read=10.0, write=5.0, pool=5.0)
 | 
						|
 | 
						|
# Глобальный клиент
 | 
						|
client = httpx.AsyncClient(
 | 
						|
    transport=ssl_transport,
 | 
						|
    limits=limits,
 | 
						|
    timeout=timeout,
 | 
						|
)
 |