ValvePython / steam

☁️ Python package for interacting with Steam
http://steam.readthedocs.io
MIT License
1.05k stars 126 forks source link

SteamAuthenticator has_phone_number JSONDecodeError #349

Open DarkApocalypse opened 2 years ago

DarkApocalypse commented 2 years ago

i got an issue with an example of code:

from steam.client import SteamClient
from steam.guard import SteamAuthenticator
import os, json

wa = SteamClient()
wa.cli_login()

sa = SteamAuthenticator(backend=wa)
sa.add()
json.dump(sa.secrets, open('./mysecrets.json', 'w'))

c = raw_input("SMS CODE")

sa.finalize(c)
sa.get_code()
wa.logout()

I have this output:

Username: [username]
Password: 
Enter email code: [code]
Traceback (most recent call last):
  File "steam-test.py", line 10, in <module>
    sa.add()    # SMS code will be send to the account's phone number
  File "[path]/.local/lib/python3.8/site-packages/steam/guard.py", line 168, in add
    if not self.has_phone_number():
  File "[path]/.local/lib/python3.8/site-packages/steam/guard.py", line 365, in has_phone_number
    resp = sess.post('https://steamcommunity.com/steamguard/phoneajax',
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
rossengeorgiev commented 2 years ago

Does this always happen? Or just one time?
Looks like the response was not in JSON format. Could have happened while Steam was down.

DarkApocalypse commented 2 years ago

I tried again and i got same error. Steam is online, and it happen everytime i test.