from telegram.ext import Updater, CommandHandler import markovify import lyricsgenius as genius import os from googletrans import Translator import pymongo import logging import timber logger = logging.getLogger(__name__) timber_handler = timber.TimberHandler(api_key=os.environ['TIMBER_TOKEN']) logger.addHandler(timber_handler) logger.setLevel(logging.INFO) class Model: def __init__(self, db, collection_name, author_name=""): self.collection = db[collection_name] self.query = { "author_name": author_name } if (len(author_name) > 0) else {} self.update_model() def add_song(self, author_name, song_name, song_id, text): if self.collection.find({"song_id": song_id}).count() == 0: self.collection.insert_one({ "author_name": author_name, "song_name": song_name, "song_id": song_id, "text": text })
import yaml from munch import Munch __app__ = "Experimental Image Formation Toolset" __author__ = "THE HERMETIC BROTHERHOOD OV SPECTRA" __license__ = "GPL3" __version__ = "0.1.7" __all__ = ["logger", "config", "LOCAL_DATA", "OCIO_VERSION", "EXTERNAL_DEPENDENCIES"] config = Munch.fromDict(yaml.safe_load(open("config.yaml"))) logger = logging.getLogger(__app__) logger.setLevel(logging._nameToLevel[config.logging.level]) timber_handler = timber.TimberHandler( config.services.timber.key, source_id=config.services.timber.source_id, ) logger.addHandler(timber_handler) LOCAL_DATA = Path.cwd() / "data" OCIO_VERSION = config.libs.OpenColorIO.version EXTERNAL_DEPENDENCIES = { "ACES-1.2 Config": { "url": "https://github.com/colour-science/OpenColorIO-Configs" "/releases/download/v1.2/OpenColorIO-Config-ACES-1.2.zip", "size": 130123781, "family": "ocio-archive", "tags": ["ACES2065-1", "ACES"], }, "Marcie ACES2065-1": {
import string import random #import self libs import test.test_get_message as t_gm from models import main as models_main from number import number_calc import logging import timber logging.basicConfig(level=logging.DEBUG) log_apikey = os.getenv('timber_apikey') logger = logging.getLogger(__name__) timber_handler = timber.TimberHandler(source_id='14767', api_key=log_apikey) timber_handler.setLevel(logging.DEBUG) # set level for EACH handler logger.addHandler(timber_handler) application = Flask(__name__) # Change assignment here #define loger func def log(logger, json_params=None, step='new', internal_id=None): logger.info("Logs: step: {0}, params: {1}".format(step, json.dumps(json_params))) #create random string def randomString(stringLength=10): """Generate a random string of fixed length """
#import self libs import test.test_get_message as t_gm from models import main as models_main import logging import timber log_apikey = os.getenv('timber_apikey') logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) source_id = os.getenv('source_id') timber_handler = timber.TimberHandler(source_id=source_id, api_key=log_apikey) logger.addHandler(timber_handler) BASIC_FORMAT = "%(levelname)s:%(message)s" FORMAT = "%(levelname)s:%(json_params)s:%(message)s" application = Flask(__name__) # Change assignment here #define loger func def log(logger, json_params=None,step='new',internal_id=None): if json_params is None: logger.info('internal_id:{0} , step:{1}'.format(internal_id,step))
from builtins import ValueError from flask import Flask, request import json import logging import timber from settings import TIMBER_API_KEY, TIMBER_SOURCE app = Flask(__name__) logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) timber_handler = timber.TimberHandler(source_id=TIMBER_SOURCE, api_key=TIMBER_API_KEY) logger.addHandler(timber_handler) COUNTER = 0 @app.route('/', methods=['POST']) def create_github_event(): """ Set up a simple endpoint to receive webhooks from Github """ data = json.loads(request.data) global COUNTER if is_closed_pull_request(data):
secret_code = os.environ.get('FLASK_SECRET') # Base config DEBUG = False TESTING = False USE_X_SENDFILE = False CSRF_ENABLED = True APPLICATION_ROOT = '/' SERVER_NAME = None #SERVER_NAME = 'api.passwd.studio:8080' SECRET_KEY = secret_code PREFERRED_URL_SCHEME = 'http' # Cookie settings SESSION_COOKIE_NAME = 'session' SESSION_COOKIE_DOMAIN = None SESSION_COOKIE_PATH = None SESSION_COOKIE_HTTPONLY = True # JSON & Jsonify JSON_AS_ASCII = True JSON_SORT_KEYS = True # LOGGING LOG_LEVEL = logging.INFO LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s' logger = logging.getLogger(__name__) logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT) timber_handler = timber.TimberHandler(source_id=timber_id, api_key=timber_key, level=LOG_LEVEL, buffer_capacity=20, flush_interval=60, raise_exceptions=True) logger.addHandler(timber_handler) LOGGER_NAME = logger
with open("timber.json", "r") as reader: data: Dict[str, str] = json.load(reader) except FileNotFoundError: try: key: str = str(os.environ["KEY"]) source_id: str = str(os.environ["ID"]) except KeyError: logging.info( "Timber package installed but credentials not provided. Uninstall package if not needed." ) else: key: str = data["key"] source_id: str = data["source"] timber_handler = timber.TimberHandler(source_id=source_id, api_key=key, raise_exceptions=True, drop_extra_events=False) root_logger.addHandler(timber_handler) logger: logging.Logger = logging.getLogger(__name__) logging.getLogger("discord.gateway").setLevel(logging.WARNING) #----------------------------------------# class Neo(commands.Bot): """ Bot class with helper functions. Inherits all attributes from commands.Bot The attributes are:
import logging import timber logger = logging.getLogger(__name__) timber_handler = timber.TimberHandler(api_key='...') logger.addHandler(timber_handler)