Closed Impulse-PW closed 6 years ago
I wouldn't structure the code like that, but it should work. I suspect the client instance is not connected when it tried to request a web session. There is not enough info to tell for sure. It would be to enable logging messages and see whats going on.
Haha yes, I'm aware that the code's kinda weird. I've been playing with it for a while and took some weird turns.
I tracked my way through the code and it looks like steam\client\builtins\web.py is returning None on line 77 where it says:
if cookies is None:
return None
I checked the code in get_web_session_cookies() and it turns out it's throwing this:
get_web_session_cookies error: maximum recursion depth exceeded while calling a Python object
This happens on line 48 where it says
resp = webapi.post('ISteamUserAuth', 'AuthenticateUser', 1, params=data)
Here's the traceback if you'd like to have a look:
Traceback (most recent call last):
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "C:\Users\piero\Desktop\programming\steamguard\steampython.py", line 28, in handle_after_logon
print(sa.has_phone_number())
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\guard.py", line 331, in has_phone_number
sess = self._get_web_session()
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\guard.py", line 260, in _get_web_session
sess = self.medium.get_web_session()
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\client\builtins\web.py", line 81, in get_web_session
cookies = self.get_web_session_cookies()
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\client\builtins\web.py", line 53, in get_web_session_cookies
resp = webapi.post('ISteamUserAuth', 'AuthenticateUser', 1, params=data)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\webapi.py", line 494, in post
return webapi_request(url, 'POST', caller=caller, session=session, params=params)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\steam\webapi.py", line 426, in webapi_request
resp = f(url, stream=False, timeout=onetime['http_timeout'], **kwargs)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 555, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connection.py", line 314, in connect
cert_reqs=resolve_cert_reqs(self.cert_reqs),
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\util\ssl_.py", line 269, in create_urllib3_context
context.options |= options
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
[Previous line repeated 311 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\hub.py", line 866, in switch
switch(value)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\greenlet.py", line 538, in run
self._report_error(sys.exc_info())
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\greenlet.py", line 520, in _report_error
self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2])
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\_tblib.py", line 370, in g
return f(a)
File "C:\Users\piero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gevent\_tblib.py", line 425, in dump_traceback
return dumps(tb)
RecursionError: maximum recursion depth exceeded while pickling an object
Sat Mar 31 09:10:46 2018 <built-in method switch of Greenlet object at 0x07635710> failed with RecursionError
I've solved the problem by adding this to the very beginning of my code:
from gevent import monkey
monkey.patch_all(thread=False)
Read #97
Here's the code that I have to attempt this:
Which in turn throws:
I believe this is a bug, I've read documentation best I can, I hope it's not a silly mistake by me.