Closed Zwork101 closed 7 years ago
Yes, you can login directly if you have the authenticator secrets.
secrets = {
'identity_secret': 'tiqenyVg1NRIW6KU8H4r0FIOcNA=',
'shared_secret': 'Xxdrby7kVXlRQniQqGHTAwC/Amo=',
...
}
SA = SteamAuthenticator(secrets)
WebAuth(username, password).login(twofactor_code=SA.get_code())
SteamClient().login(username, password, two_factor_code=SA.get_code())
Thank you, I wasn't sure if it was possible. Will make it an example, or not?
Also, does the login create a loop? I'm starting to have Recursion errors on the steampy login
Are you using python3.6 ?
That's correct, is it not supported?
There is a bug with python3.6 and gevent. It might be fixed in the future. The work around is to do the gevent patching before anything else. So the very first code, even before any imports should be:
import gevent.monkey
gevent.monkey.patch_socket()
gevent.monkey.patch_ssl()
This is only needed when you use SteamClient
at some point
Details on #97
Thanks, I don't have that error anymore. I do have invalidCredentials, but I think I've either made too many login requests, or I goofed
Ok, so that login error? You may not know howto fix it, cause it looks like it's on steampy's side, but its always a login error on steampy if I run steam in the same execution. If I run the 2 in seprate files, they work fine, but it looks like they can't be ran together. Is there a fix to this?
I'm not familiar with steampy
either, but I don't see why you can't use both. If you make a gist with the code I can take a look.
Looks like steampy
also copied code from the steam
package without respecting the MIT license. 😈
Oh noes, how could he?
So, here is the gist, https://gist.github.com/Zwork101/441ac3e8ed2ed5c595255f3cd668fd9a, I feel like I may have it set in private, I'm not sure. I'm gonna try logging in through steampy first, and then steam
Never mind then, XD. So, apparently, don't login to the steam
package, before the steampy
package. That's super weird, but I guess that's how it is. You can close this now, idk howto.
Do you use the same authenticator code for both login? Because, its one time use.
Nope, gave bolth the secrets to generate there own code. I have no clue why I got that error
Ok, unlrealted, but sense this question was still up, might as well ask it
So, this works in python 3.5,
@client.friends.on(client.friends.EVENT_FRIEND_INVITE)
but in python 3.6:
Traceback (most recent call last):
File "C:/Users/Zwork101/my_envs/SteamBot/CardFarmSend.py", line 43, in <module>
@client.friends.on(steam.client.builtins.friends.SteamFriendlist.EVENT_FRIEND_INVITE)
AttributeError: 'EResult' object has no attribute 'friends'```
I feel like I'm missing something somewhere, I have the same imports as the python 3.5 version. And can't figure out why I would be getting an error
Nope, gave bolth the secrets to generate there own code. I have no clue why I got that error
That doesn't matter. Code interval is 30s, it will generate the same code within these 30 seconds. Since it can only be used one time, you have to either +30s the current time, or wait a bit.
AttributeError: 'EResult' object has no attribute 'friends'```
Strange error. There isn't enough context for me to answer.
Ok, that's good to know. And the login is working fine now.
import gevent.monkey
gevent.monkey.patch_socket()
gevent.monkey.patch_ssl()
import steam
from steam import guard
from steam import SteamClient
from steam import client
from steam.enums import EResult
from steam.core.msg import MsgProto
from steam.enums.emsg import EMsg
from steampy.client import SteamClient as SC
from steampy.client import Asset
from steampy.utils import GameOptions
import json
import time
import csv
username = 'username'
CardSets = {}
password = 'password'
SteamAuthenticator = guard.SteamAuthenticator #Don't change
with open('SetData.csv', 'r', encoding='UTF-8') as SetData:
reader = csv.DictReader(SetData)
for row in reader:
CardSets[row['Game']] = row['# Cards']
with open('SteamGuard.txt', 'r') as LoginInfo:
strData = LoginInfo.read()
secrets = {
'identity_secret': json.loads(strData)['identity_secret'],
'shared_secret': json.loads(strData)['shared_secret'],
}
print('Login API')
steam_client = SC('Api Code')
print('Login account')
steam_client.login(username,password,"SteamGuard.txt")
print('Login Steam')
SA = SteamAuthenticator(secrets)
client = SteamClient().login(username, password, two_factor_code=SA.get_code())
@client.friends.on(client.friends.EVENT_FRIEND_INVITE)
def handle_friend_invite(friend):
print("Received friend invite from: %s (%s)" % (repr(friend.name), friend.steam_id.community_url))
client.friends.add(friend.steam_id)
I just copy and pasted most of this code from my steam bot in 3.5, but I'm in 3.6 now and I'm getting an error. That may not even be the reason, but I thought I'd let you know
client = SteamClient().login(username, password, two_factor_code=SA.get_code())
That line is your problem. You set client
to the return value from login()
Ah, my bad, I should have spotted that
Thanks for the help :D
So, I want to run a program with steampy and steam side-by-side, and I use steampy's automated login, if you can give it the account secrets. But having to also login because of the steam modal makes it more inefficient. Is it possible to login, without putting in any credentials? And if the answer is yes, I would suggest that we make it a example, because its not that obvious, if you ask me, on howto do it.