Пример #1
0
    def __init__(self):
        super().__init__()
        welcome()
        settings = load_settings()
        self._upload = settings['upload']  # 上传的图片所在目录
        self._download = settings['download']  # 下载的文件
        self.sleep_time = settings["sleep_time"]  # 下载网页源代码所等待的时间
        self.separate = settings["separate"]  # 是否分割开下载的数据文件和当前的图片
        self.extention = settings["extention"]
        self.mirror = settings["mirror"]  # 是否使用镜像网站

        brower = settings["brower"]
        profile = settings["profile_path"]
        # profile 自定义可以参考 https://blog.csdn.net/weixin_44676081/article/details/106322068
        if brower == "firefox":
            try:
                self.driver = webdriver.Firefox(
                    firefox_profile=FirefoxProfile(profile),
                    executable_path=settings["webdriver_path"])
            except Exception as e:
                print(e)
        else:
            try:
                options = webdriver.ChromeOptions()
                options.add_argument("--user-data-dir=" + profile)
                self.driver = webdriver.Chrome(
                    executable_path=settings["webdriver_path"])
            except Exception as e:
                print(e)
Пример #2
0
def start():
    try:
        welcome()
        start_server = websockets.serve(handler, "127.0.0.1", 8765)
        asyncio.get_event_loop().run_until_complete(start_server)
        asyncio.get_event_loop().run_forever()
    except OSError:
        print("[-] 127.0.0.1:8765 already in use!")
Пример #3
0
def main():
    welcome()
    config = configparser.ConfigParser()
    config.read('config')
    ts = TwitchStats(username=config['account']['login'],
                     auth_token=config['account']['oauth'],
                     db_uri="mongodb://127.0.0.1:27017/",
                     db_name="twitch")
    for channel in config["channels"]:
        ts.add_channel(channel)
    ts.loop(60)
Пример #4
0
def main():
    load_bank_data()
    cleaner()
    header()
    account_auth = auth_account()

    if account_auth:
        cleaner()
        header()
        welcome(account_auth)

        while True:
            option_typed = get_menu_options_typed(account_auth)

            do_operation(option_typed, account_auth)

            print()
            loop_typed = input('Deseja sair da conta S/n? ')
            if not loop_typed == 'n':
                print('Bye')
                break
    else:
        print('Conta inválida')
Пример #5
0
    def __init__(self):
        super().__init__()
        welcome()
        settings = load_settings()
        self._upload = settings['upload']  # 上传的图片所在目录
        self._download = settings['download']  # 下载的文件
        self.separate = settings["separate"]  # 是否分割开下载的数据文件和当前的图片
        self.extention = settings["extention"]
        self.mirror = settings["mirror"]  # 是否使用镜像网站
        self.session = requests.Session()
        self.url = "https://images.soik.top/searchbyimage/upload"
        self.getOriginPic = settings["getOriginPic"]  # 是否下载原始图片

        self.session.headers = {
            "Host":
            "images.soik.top",
            "User-Agent":
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/85.0.564.44",
        }
        if not self.mirror:
            self.session.headers["Host"] = "www.google.com"
            self.url = "https://www.google.com/searchbyimage/upload"

        self.session.verify = False
Пример #6
0
def main():
    welcome()
    generate_graph_today("mystream")
Пример #7
0
 def speak(self):
     """supposed to speak"""
     welcome(self.name)
     goodbye(self.name)
Пример #8
0
from random import randrange
from utils import correct_it, game_over, right, wrong, welcome, get_tip
import data

points = 0
asks = 0
total_types = len(data.exercises)

if __name__ == '__main__':
    welcome()
    while True:
        collection = data.exercises[randrange(total_types)]
        questions = collection["questions"]
        type_of_collection = collection["type"]
        question, answers = questions[randrange(len(questions))]

        print(question)
        get_tip(collection["tip"])
        your_answer = input()

        if your_answer == "exit":
            break

        asks += 1
        if correct_it(type_of_collection, question, your_answer, answers):
            right()
            points += 1
        else:
            wrong(type_of_collection, question, answers)

    game_over(asks, points)
Пример #9
0
 def be_silent(self):
     """supposed to be silent"""
     goodbye(self.code)
     welcome(self.code)
Пример #10
0
def main() -> None:
    user_input = (utils.welcome()).lower().lstrip().rstrip()  # Display Menu

    while user_input != "q":
        if user_input == "a":  # Single Player against Computer
            player1_name = utils.get_player_name(
                num=1).lower().lstrip().rstrip()
            player1_choice = utils.get_player_choice(name=player1_name)

            # input validation
            while player1_choice.lower() not in ["r", "s", "p"]:
                player1_choice = utils.get_player_choice(name=player1_name)

            computer_choice = utils.get_computer_choice()

            player1 = tuple((player1_name, player1_choice))
            computer = tuple(("Computer", computer_choice))

            print(utils.print_choices(player1=player1, player2=computer))

            winner = utils.check_winner(player1=player1,
                                        player2=computer).lower()

            if winner == "tie":
                print(utils.print_winner(winner=winner, tie=True))
            else:
                print(utils.print_winner(winner=winner, tie=False))

        elif user_input == "b":  # Two Player
            player1_name = utils.get_player_name(
                num=1).lower().lstrip().rstrip()
            player2_name = utils.get_player_name(num=2)

            player1_choice = utils.get_player_choice(name=player1_name)
            # input validation
            while player1_choice.lower() not in ["r", "s", "p"]:
                player1_choice = utils.get_player_choice(name=player1_name)

            player2_choice = utils.get_player_choice(name=player2_name)
            # input validation
            while player1_choice.lower() not in ["r", "s", "p"]:
                player2_choice = utils.get_player_choice(name=player2_name)

            player1 = (player1_name, player1_choice)
            player2 = (player2_name, player2_choice)

            winner = utils.check_winner(player1=player1, player2=player2)

            if winner.lower() == "tie":
                print(utils.print_winner(winner=winner, tie=True))
            else:
                print(utils.print_winner(winner=winner, tie=False))
        elif user_input == "q":  # Quit
            print("THANK YOU FOR PLAYING, GOODBYE!")
            return
        else:
            print("IMPROPER INPUT! Please choose one of the options in menu.")

        user_input = (
            utils.welcome()).lower().lstrip().rstrip()  # Display Menu

    if user_input == "q":
        print("THANK YOU FOR PLAYING, GOODBYE!")
        return
Пример #11
0
def main():
    welcome()
    upload("mystream", shift=-1)
Пример #12
0
def main():
    with Database() as db:
        db.create_table()
        display(first=True)
        while True:
            welcome(db)