コード例 #1
0
 def test_source_works(self):
     testfile = tempfile.NamedTemporaryFile()
     testfile.write(self.testdata)
     testfile.seek(0)
     conf = config.source(testfile.name)
     self.assertEqual(conf['test'], "korrekt!")
     self.assertEqual(conf['potatoes'], ["first", "second"])
コード例 #2
0
from fastapi import APIRouter
import config

get, post, update, delete = config.source()

companies_router = router = APIRouter()


@router.get('')
async def get_companies():
    return await get.companies()


@router.get('/<id>')
async def get_company(id: str):
    return await get.company(_id=id)


@router.delete('')
async def delete_companies():
    return await delete.all_companies()
コード例 #3
0
import discord

#Activate logging
import logging
logging.basicConfig(level=logging.INFO)

#Import the actions module
from actions import actions

#Import the config module
import config

conf = config.source('config.yml')

#Start the stuff
actions.bot.run(conf['discord_token'])