Compare commits
2 Commits
5e50bccd53
...
b6b96a8661
Author | SHA1 | Date |
---|---|---|
Kay Faraday | b6b96a8661 | |
PeachyDelight | 970903c3c0 |
|
@ -4,6 +4,8 @@ import sqlite3
|
||||||
from random import expovariate
|
from random import expovariate
|
||||||
import typing
|
import typing
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from utils import http_session_factory
|
||||||
|
|
||||||
|
|
||||||
async def make_sentence(cfg):
|
async def make_sentence(cfg):
|
||||||
# set default
|
# set default
|
||||||
|
@ -81,8 +83,8 @@ async def make_sentence(cfg):
|
||||||
# using aiohttp
|
# using aiohttp
|
||||||
|
|
||||||
post = None
|
post = None
|
||||||
|
async with http_session_factory() as session:
|
||||||
while post is None:
|
while post is None:
|
||||||
async with aiohttp.ClientSession() as session:
|
|
||||||
async with session.post(
|
async with session.post(
|
||||||
"https://api.textsynth.com/v1/engines/{}/completions".format(cfg["textsynth_engine_id"]),
|
"https://api.textsynth.com/v1/engines/{}/completions".format(cfg["textsynth_engine_id"]),
|
||||||
headers={
|
headers={
|
||||||
|
|
Loading…
Reference in New Issue