steam icon indicating copy to clipboard operation
steam copied to clipboard

SteamAuthenticator has_phone_number JSONDecodeError

Open DarkApocalypse opened this issue 4 years ago • 2 comments

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)

DarkApocalypse avatar Aug 03 '21 15:08 DarkApocalypse

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

rossengeorgiev avatar Aug 05 '21 16:08 rossengeorgiev

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

DarkApocalypse avatar Aug 05 '21 16:08 DarkApocalypse