| 116 | |
| 117 | |
| 118 | async def post(endpoint: str, json: dict | None = None): |
| 119 | global sess # pylint: disable=global-statement |
| 120 | # sess = sess if sess is not None else await session() |
| 121 | if sess and not sess.closed: |
| 122 | await sess.close() |
| 123 | sess = await session() |
| 124 | try: |
| 125 | async with sess.post(url=endpoint, json=json, verify_ssl=False) as req: |
| 126 | res = await result(req) |
| 127 | return res |
| 128 | except Exception as err: |
| 129 | log.error({ 'session': err }) |
| 130 | return {} |
| 131 | |
| 132 | |
| 133 | def postsync(endpoint: str, json: dict | None = None): |