You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue with creating a small web application whuch will wait for request with profile id and return it's profile card, but it seems like jobs and events are not working when hosting it as Flask or FastAPI apps. For me it seems like a bug but I'm not sure.
Do you have ideas?
from steam.client import SteamClient
from dota2.client import Dota2Client
from flask import Flask, Response
logging.basicConfig(
format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)
username = "login"
password = "password"
app = Flask(__name__)
steamClient = SteamClient()
dota = Dota2Client(steamClient)
@dota.on('ready')
def fetch_profile_card():
logging.info('Logged in to Dota 2')
pass
@dota.on('profile_card')
def print_profile_card(account_id, profile_card):
if profile_card:
logging.log("Got the profile card")
# @app.get("/getPlayerProfile/{playerId}") # use this for FaskAPI
@app.route('/getPlayerProfile/<int:playerId>', methods=['GET'])
def getUserProfile(playerId):
logging.log(logging.INFO, 'Got GETUSERPROFILE event with %d player ID' % int(playerId))
# we hardcode here so you can send everything you want it will try to obtain profile card from tutorial
jobid = dota.request_profile_card(70388657)
profile_card = dota.wait_msg(jobid, timeout=10)
if profile_card:
return Response(status=200, response='event emited and got profile card')
else:
return Response(status=404, response='event emited and got no profile card')
try:
if dota.ready is not True:
steamClient.login(username, password, login_id=774)
dota.launch()
dota.wait_event('ready')
app.run()
except KeyboardInterrupt:
steamClient.logout()
The text was updated successfully, but these errors were encountered:
@rossengeorgiev thanks for the answer. It was really helpful.
But I'm also not sure what's the idea of set_credential_location() method. It does not create any file in my file system or even if I create cm_servers.json file myself (because this is the only files related error I see in logs) SteamClient does not override it
Where can I find any info about how this file works or how should I fill it to ex. not pass login and password everytime and just use client.login()?
I have an issue with creating a small web application whuch will wait for request with profile id and return it's profile card, but it seems like jobs and events are not working when hosting it as Flask or FastAPI apps. For me it seems like a bug but I'm not sure.
Do you have ideas?
The text was updated successfully, but these errors were encountered: