def find_server(self, channel): try: result = TwitchApi.chat_properties(channel) if result: return random.choice(result['chat_servers']) except KeyError as e: logger.warning("got an empty json response to a chat properties request %s", e) return None
def test_channel_striping(self, _load_json): TwitchApi.chat_properties('#channel') self.assertEqual(_load_json.call_count, 1) self.assertIn('channel', _load_json.call_args[0][0].split('/'))