client¶
Only the most essential features to dota2.client.Dota2Client are found here. Every other feature is inherited from
the dota2.features package and it’s submodules.
-
class
dota2.client.Dota2Client(steam_client)¶ Bases:
steam.client.gc.GameCoordinator,dota2.features.FeatureBaseParameters: steam_client ( steam.client.SteamClient) – Instance of the steam client-
verbose_debug= False¶ enable pretty print of messages in debug logging
-
app_id= 570¶ main client app id
-
ready= False¶ Truewhen we have a session with GC
-
connection_status= 2¶ dota2.enums.GCConnectionStatus
-
account_id¶ Account ID of the logged in user in the steam client
-
steam_id¶ steam.steamid.SteamIDof the logged-in user in the steam client
-
wait_msg(event, timeout=None, raises=None)¶ Wait for a message, similiar to
wait_event()Parameters: - event –
EDOTAGCMsgor job id - timeout (
int) – seconds to wait before timeout - raises (
bool) – On timeout whenFalsereturnsNone, else raisegevent.Timeout
Returns: returns a message or
NoneReturn type: None, or proto messageRaises: ``gevent.Timeout`
- event –
-
send_job(*args, **kwargs)¶ Send a message as a job
Exactly the same as
send()Returns: jobid event identifier Return type: str
-
send_job_and_wait(emsg, data={}, proto=None, timeout=None, raises=False)¶ Send a message as a job and wait for the response.
Note
Not all messages are jobs, you’ll have to find out which are which
Parameters: Returns: response proto message
Raises: gevent.Timeout`
-
send(emsg, data={}, proto=None)¶ Send a message
Parameters: - emsg – Enum for the message
- data (
dict) – data for the proto message - proto – (optional) manually specify protobuf, other it’s detected based on
emsg
-
launch()¶ Launch Dota 2 and establish connection with the game coordinator
readyevent will fire when the session is ready. If the session is lostnotreadyevent will fire. Alternatively,connection_statusevent can be monitored for changes.
-
exit()¶ Close connection to Dota 2’s game coordinator
-
sleep(seconds)¶ Yeild and sleep N seconds. Allows other greenlets to run
-
idle()¶ Yeild in the current greenlet and let other greenlets run
-