Initializing the client¶
A client can be initialized in order to either make requests anonymously,
or through an account, by instantiating a Client
in an
asynchronous context:
from planetcasio.client import Client
async with Client() as client:
...
If you wish to authenticate as an account in order to access operations that
require it, you can pass the credentials of the user to authenticate as
through the auth
keyword parameter:
from planetcasio.client import Client
async with Client(auth=("<username>", "<password>")) as client:
...
You can obtain a session cookie to use in separate requests by calling
Account.get_cookie()
:
from planetcasio.client import Client
async with Client(auth=("<username>", "<password>")) as client:
token = await client.account.get_cookie()
...