Closed Mrfull closed 3 years ago
You are likely hitting this: https://github.com/ValvePython/steam/issues/97
Yes, i saw i't but it's didn't help New come after ValvePython/steam#97
`from steam.client import SteamClient from dota2.client import Dota2Client from steam.enums import EResult from dota2.proto_enums import DOTA_GameMode from steam.steamid import SteamID
import logging from gevent import monkey monkey.patch_all(thread=False)
logging.basicConfig( format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG )
class DotaLobbyManager: def init(self): monkey.patch_socket() monkey.patch_ssl() self.client = SteamClient() self.dota = Dota2Client(self.client)
# def main(lobby_name, password, players):
def main(self):
lobby_name = "test"
players = ["[REDACTED]"]
password = ""
print("start controller ")
self.dota.destroy_lobby()
self.dota.exit()
try:
self.login_in_steam("[REDACTED]", "[REDACTED]")
except RuntimeError as err:
print(err.args)
# client.wait_event('logged_on')
print('starting dota2...')
self.start_dota()
# dota.wait_event('ready')
self.dota.destroy_lobby()
self.create_lobby(lobby_name, password)
self.dota.wait_event('lobby_new')
print('lobby {} created'.format(self.dota.lobby.lobby_id))
self.invite_players_to_lobby(players)
self.dota.wait_event('lobby_changed')
self.dota.leave_practice_lobby()
self.dota.exit()
self.client.logout()
def login_in_steam(self, login, password):
result = self.client.login(login, password)
# result = client.cli_login()
if result != EResult.OK:
raise RuntimeError("Login failed")
def start_dota(self):
self.dota.launch()
def create_lobby(self, lobby_name, password):
settings = {
'game_name': lobby_name,
"game_mode": DOTA_GameMode.DOTA_GAMEMODE_1V1MID,
"pass_key": "PWA",
}
self.dota.create_practice_lobby(password, settings)
def invite_players_to_lobby(self, players):
for player in (SteamID(p) for p in players):
print('invite player {}'.format(player))
self.dota.invite_to_lobby(player)
`
Btw you have your user and pass in the code.
Yeah, for sure i did it. If i don't do it. i can't even create lobby
I add my code on django website, but get this error Code: `from steam.client import SteamClient from dota2.client import Dota2Client from steam.enums import EResult from dota2.proto_enums import DOTA_GameMode from steam.steamid import SteamID
client = SteamClient() dota = Dota2Client(client)
def main(lobby_name, password, players): print("start controller ")
def login_in_steam(login, password): result = client.login(login, password)
result = client.cli_login()
def start_dota(): dota.launch()
def create_lobby(lobby_name, password): settings = { 'game_name': lobby_name, "game_mode": DOTA_GameMode.DOTA_GAMEMODE_1V1MID, "pass_key": "PWA", } dota.create_practice_lobby(password, settings)
def invite_players_to_lobby(players): for player in (SteamID(p) for p in players): print('invite player {}'.format(player)) dota.invite_to_lobby(player)
`
Error code
start controller some WebAPI boostrap failed: maximum recursion depth exceeded