Python config.username() Examples
The following are 6
code examples of config.username().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
config
, or try the search function
.
Example #1
Source File: run.py From showdown with GNU General Public License v3.0 | 6 votes |
def parse_configs(): env = Env() env.read_env() config.battle_bot_module = env("BATTLE_BOT", 'safest') config.save_replay = env.bool("SAVE_REPLAY", config.save_replay) config.use_relative_weights = env.bool("USE_RELATIVE_WEIGHTS", config.use_relative_weights) config.gambit_exe_path = env("GAMBIT_PATH", config.gambit_exe_path) config.search_depth = int(env("MAX_SEARCH_DEPTH", config.search_depth)) config.greeting_message = env("GREETING_MESSAGE", config.greeting_message) config.battle_ending_message = env("BATTLE_OVER_MESSAGE", config.battle_ending_message) config.websocket_uri = env("WEBSOCKET_URI", "sim.smogon.com:8000") config.username = env("PS_USERNAME") config.password = env("PS_PASSWORD", "") config.bot_mode = env("BOT_MODE") config.team_name = env("TEAM_NAME", None) config.pokemon_mode = env("POKEMON_MODE", constants.DEFAULT_MODE) config.run_count = int(env("RUN_COUNT", 1)) if config.bot_mode == constants.CHALLENGE_USER: config.user_to_challenge = env("USER_TO_CHALLENGE") init_logging(env("LOG_LEVEL", "DEBUG"))
Example #2
Source File: TestEOS.py From pyeos with Apache License 2.0 | 5 votes |
def setUpClass(cls): cls.device = EOS(config.hostname, config.username, config.password, config.use_ssl) cls.device.open()
Example #3
Source File: TestFortiOS.py From pyfg with Apache License 2.0 | 5 votes |
def setUpClass(cls): cls.device = FortiOS(config.vm_ip, vdom='test_vdom', username=config.username, password=config.password) cls.device.open() with open(config.config_file_1, 'r') as f: cls.config_1 = f.readlines() with open(config.config_file_2, 'r') as f: cls.config_2 = f.readlines()
Example #4
Source File: twitchy.py From twitchy_the_bot with MIT License | 5 votes |
def reddit_setup(self): print "Logging in" r = praw.Reddit("Sidebar livestream updater for /r/{} by /u/andygmb ".format(subreddit)) r.login(username=username, password=password, disable_warning=True) sub = r.get_subreddit(subreddit) return r, sub
Example #5
Source File: run.py From showdown with GNU General Public License v3.0 | 5 votes |
def showdown(): parse_configs() apply_mods(config.pokemon_mode) original_pokedex = deepcopy(pokedex) original_move_json = deepcopy(all_move_json) ps_websocket_client = await PSWebsocketClient.create(config.username, config.password, config.websocket_uri) await ps_websocket_client.login() battles_run = 0 wins = 0 losses = 0 while True: team = load_team(config.team_name) if config.bot_mode == constants.CHALLENGE_USER: await ps_websocket_client.challenge_user(config.user_to_challenge, config.pokemon_mode, team) elif config.bot_mode == constants.ACCEPT_CHALLENGE: await ps_websocket_client.accept_challenge(config.pokemon_mode, team) elif config.bot_mode == constants.SEARCH_LADDER: await ps_websocket_client.search_for_match(config.pokemon_mode, team) else: raise ValueError("Invalid Bot Mode") winner = await pokemon_battle(ps_websocket_client, config.pokemon_mode) if winner == config.username: wins += 1 else: losses += 1 logger.info("W: {}\tL: {}".format(wins, losses)) check_dictionaries_are_unmodified(original_pokedex, original_move_json) battles_run += 1 if battles_run >= config.run_count: break
Example #6
Source File: twitchy.py From twitchy_the_bot with MIT License | 4 votes |
def check_inbox(self): if self.config["accept_messages"].lower() not in ["false", "no", "n"]: streams = [] inbox = self.r.get_inbox() print "Checking inbox for new messages" for message in inbox: if message.new \ and message.subject == "Twitch.tv request /r/{}".format(self.subreddit): message_content = message.body.split()[0] try: re_pattern = 'twitch.tv/(\w+)' # pattern matches twitch username in the first group re_result = re.search(re_pattern, message_content) if re_result: stream_name = re_result.group(1).lower() # extract the username stored in regex group 1 else: print "Could not find stream name in message." continue # skip to next message except ValueError: message.mark_as_read() stream_name = "null" print "Could not find stream name in message." if "twitch.tv/" in message_content \ and len(stream_name) <=25 \ and stream_name not in self.banned \ and stream_name not in self.streams: streams.append(stream_name) message.reply(self.config["messages"]["success"].format(subreddit=self.subreddit)) message.mark_as_read() elif stream_name in self.banned: message.reply(self.config["messages"]["banned"].format(subreddit=self.subreddit)) message.mark_as_read() elif stream_name in self.streams: message.reply(self.config["messages"]["already_exists"].format(subreddit=self.subreddit)) message.mark_as_read() if streams: new_streams = list(set([stream for stream in streams if stream not in [self.streams, self.banned]])) self.streams.extend(new_streams) self.subreddit.edit_wiki_page( self.config["wikipages"]["stream_list"], "\n".join(self.streams), reason="Adding stream(s): " + ", ".join(new_streams) ) else: print "Skipping inbox check as accept_messages config is set to False." pass