whatever, i'm just testing

This commit is contained in:
Frisk 2020-07-10 01:58:25 +02:00
parent ac2abdefec
commit dafc849321
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
4 changed files with 15 additions and 36 deletions

View file

@ -1,12 +1,20 @@
import logging.config
from src.config import settings
import sqlite3
from src.wiki import Wiki
logging.config.dictConfig(settings["logging"])
logger = logging.getLogger("rcgcdb.bot")
logger.debug("Current settings: {settings}".format(settings=settings))
# Fetch basic information about all of the wikis in the database
conn = sqlite3.connect('rcgcdb.db')
c = conn.cursor()
# Fetch basic information about all of the wikis in the database
all_wikis = {}
for wiki in c.execute('SELECT * FROM wikis'):
all_wikis[wiki[0]] = Wiki() # assign cached information
# Start queueing logic

View file

@ -1,10 +1,10 @@
import json, sys, logging
try: # load settings
with open("settings.json") as sfile:
with open("../settings.json") as sfile:
settings = json.load(sfile)
if "user-agent" in settings["header"]:
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.11") # set the version in the useragent
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.0") # set the version in the useragent
except FileNotFoundError:
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
sys.exit(1)

View file

@ -1,33 +0,0 @@
{
"header": {
"user-agent": "RcGcDb/{version}"
},
"logging": {
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"standard": {
"format": "%(name)s - %(levelname)s: %(message)s"
}
},
"handlers": {
"default": {
"formatter": "standard",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"": {
"level": 0,
"handlers": [
"default"
]
},
"rcgcdb": {},
"rcgcdb.bot": {},
"rcgcdb.config": {},
"rcgcdb.discord": {}
}
}
}

View file

@ -1 +1,5 @@
from dataclasses import dataclass
@dataclass
class Wiki:
fail_times: int = 0 # corresponding to amount of times connection with wiki failed for client reasons (400-499)