Skip to content

Commit

Permalink
include connection checker
Browse files Browse the repository at this point in the history
aiya will wait for a response from web ui if none is found
also reorder imports
  • Loading branch information
Kilvoctu committed Nov 10, 2022
1 parent 61331b7 commit d4ddc6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions aiya.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio
import discord
import os
import sys
import discord
from dotenv import load_dotenv
from core.logging import get_logger
from core import settings
from core.logging import get_logger
from dotenv import load_dotenv


#start up initialization stuff
Expand Down
12 changes: 11 additions & 1 deletion core/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import csv
import discord
import json
import os
import requests
import time
from typing import Optional
import discord

self = discord.Bot()
dir_path = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -116,6 +117,15 @@ def files_check():
print(f'The folder for DIR doesn\'t exist! Creating folder at {global_var.dir}.')
os.mkdir(global_var.dir)

#check if Web UI is running
connected = False
while not connected:
try:
return requests.head(global_var.url)
except Exception as e:
print(f'Waiting for Web UI at {global_var.url}...')
time.sleep(20)

#pull list of samplers and styles from api
with requests.Session() as s:
if global_var.username is not None:
Expand Down

0 comments on commit d4ddc6e

Please sign in to comment.