def register_notify_channel(): notify = Notify() if config.has_option('notify-run', 'channel'): notify.endpoint = 'https://notify.run/' + config['notify-run'][ 'channel'] main_logger.info( 'Will use self provided channel: https://notify.run/c/' + config['notify-run']['channel']) elif notify.config_file_exists: main_logger.info( 'Will use notify-run saved config: https://notify.run/c/' + notify.endpoint[19:]) else: main_logger.info( 'Neither my own nor notify-run config channel was found. Will register new...' ) main_logger.info(notify.register()) return notify
from collections import Counter from notify_run import Notify import os import time import dropbox import json dropboxkey = "" notify = Notify() notifyendpoint = "" notify.endpoint = notifyendpoint notify.write_config() from flask import Flask, request maindictionary = {} dbx = dropbox.Dropbox(dropboxkey) dbx.files_download_to_file("bannedpixel.txt", "/bannedpixel.txt") dbx.files_download_to_file("logpixel.txt", "/logpixel.txt") dbx.files_download_to_file("dictionary.txt", "/dictionary.txt") app = Flask(__name__) @app.route("/pixel") def home(): maindictionary = json.load(open("dictionary.txt")) if (request.args.get("id")) in open("bannedpixel.txt").read(): pass elif open("logpixel.txt").read().count(request.args.get("id")) == 0: with open("logpixel.txt", "a+") as f: f.writelines(request.args.get("id") + "\n") dbx = dropbox.Dropbox("")