def test_client_login(codingame): email = os.environ.get("TEST_LOGIN_EMAIL") password = os.environ.get("TEST_LOGIN_PASSWORD") # login at creation client = codingame.Client(email, password) assert client_attr(client) # login after creation client = codingame.Client() client.login(email, password) assert client_attr(client)
async def on_ready(self): self.cg_client = codingame.Client(is_async=True) for cog in Config.DEFAULT_COGS: self.load_extension(cog) self.logger.info(color("loaded all cogs", "green")) await self.change_presence(activity=discord.Game( name=f"{Config.PREFIX}help")) self.logger.debug(color(f"set status to `{Config.PREFIX}help`", "cyan")) self.logger.info(color(f"logged in as user `{self.user}`", "green"))
import codingame client = codingame.Client() # get a codingamer from their pseudo or public handle codingamer = client.get_codingamer("a pseudo or public handle here") print(codingamer) print(codingamer.pseudo) print(codingamer.public_handle) print(codingamer.avatar_url)
import codingame client = codingame.Client() client.login("email", "password") # or client = codingame.Client("email", "password") # then you can access the logged in codingamer like this print(client.logged_in) print(client.codingamer) print(client.codingamer.pseudo) print(client.codingamer.public_handle) print(client.codingamer.avatar_url)
def client(): import codingame return codingame.Client()
def test_client(codingame): client = codingame.Client() assert client_attr(client)