Set client session for sagemcom client
The default client session timeout is too short (7 seconds); Use the default from aiohttp (300 seconds)
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from aiohttp import ClientSession, ClientTimeout
|
||||||
|
from aiohttp.connector import TCPConnector
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from ipaddress import IPv4Address
|
from ipaddress import IPv4Address
|
||||||
@@ -29,7 +31,13 @@ class EnumChoice(click.Choice):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def cli(ctx: click.Context, host: str, username: str, password: str, authentication_method: EncryptionMethod) -> None:
|
async def cli(ctx: click.Context, host: str, username: str, password: str, authentication_method: EncryptionMethod) -> None:
|
||||||
ctx.obj = client = await ctx.with_async_resource(
|
ctx.obj = client = await ctx.with_async_resource(
|
||||||
SagemcomClient(host, username, password, authentication_method, ssl=True, keep_keys=True)
|
SagemcomClient(host, username, password, authentication_method,
|
||||||
|
ClientSession(
|
||||||
|
headers={"User-Agent": "XMO_REMOTE_CLIENT/1.0.0"},
|
||||||
|
timeout=ClientTimeout(),
|
||||||
|
connector=TCPConnector(ssl=True),
|
||||||
|
), True, keep_keys=True
|
||||||
|
)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await client.login()
|
await client.login()
|
||||||
|
|||||||
Reference in New Issue
Block a user