MCPcopy
hub / github.com/vladmandic/sdnext / session

Function session

cli/sdapi.py:208–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206
207
208async def session():
209 global sess # pylint: disable=global-statement
210 time = aiohttp.ClientTimeout(total = None, sock_connect = 10, sock_read = None) # default value is 5 minutes, we need longer for training
211 sess = aiohttp.ClientSession(timeout = time, base_url = sd_url, auth=auth())
212 log.debug({ 'sdapi': 'session created', 'endpoint': sd_url })
213 """
214 sess = await aiohttp.ClientSession(timeout = timeout).__aenter__()
215 try:
216 async with sess.get(url = f'{sd_url}/') as req:
217 log.debug({ 'sdapi': 'session created', 'endpoint': sd_url })
218 except Exception as e:
219 log.error({ 'sdapi': e })
220 await asyncio.sleep(0)
221 await sess.__aexit__(None, None, None)
222 sess = None
223 return sess
224 """
225 return sess
226
227
228async def close():

Callers 3

mainFunction · 0.90
getFunction · 0.85
postFunction · 0.85

Calls 1

authFunction · 0.70

Tested by

no test coverage detected