smstools-http-api icon indicating copy to clipboard operation
smstools-http-api copied to clipboard

RuntimeError: maximum recursion depth error

Open robitmoh opened this issue 5 years ago • 1 comments

Hi!

Installed the smsmtools-http-api but found error

when open "/api/v1.0/sms/outgoing/" (eq with incomnig (any kind) )

RuntimeError: maximum recursion depth exceeded while calling a Python object..
Traceback (most recent call last):
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask_httpauth.py", line 93, in decorated
    return f(*args, **kwargs)
  File "/opt/smstools-http-api/app/api_1_0/views.py", line 18, in list_some_sms
    return list_some_sms(kind)
....... repeated more times ............
File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask_httpauth.py", line 88, in decorated
    if not self.authenticate(auth, password):
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/flask_httpauth.py", line 125, in authenticate
    return self.verify_password_callback(username, client_password)
  File "/opt/smstools-http-api/app/api_1_0/authentication.py", line 18, in verify_password
    if htpasswd_file.check_password(login, password):
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/apache.py", line 852, in check_password
    ok, new_hash = self.context.verify_and_update(password, hash)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/context.py", line 2428, in verify_and_update
    if not record.verify(secret, hash, **clean_kwds):
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/utils/handlers.py", line 757, in verify
    self = cls.from_string(hash, **context)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/handlers/md5_crypt.py", line 213, in from_string
    return cls(salt=salt, checksum=chk)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/utils/handlers.py", line 1376, in __init__
    super(HasSalt, self).__init__(**kwds)
  File "/opt/smstools-http-api/venv/lib/python2.7/site-packages/passlib/utils/handlers.py", line 590, in __init__
    super(GenericHandler, self).__init__(**kwds)
RuntimeError: maximum recursion depth exceeded while calling a Python object

When open "api/v1.0/sms/incoming/GSM1.0H09ye" already come the json object.

I try to checkout older states to "258a4b0362aa739c323d986ddc741c1160280e71" comit but no changes

I try to change

 def list_some_sms(kind):
     result = {}
     return jsonify(result)

but no changes

I use Debian Linux jessie python2.7.9

robitmoh avatar Mar 04 '20 08:03 robitmoh

I can confirm same issue on Linux Python 2.7, 3.5 and 3.7. The problem is caused by overusing local namespace. Here is small workaround using namespace smstools for invoking method from smstool.py to avoid recursion:

from . import smstools

...
@api_1_0.route('/sms/<kind>/', methods=['GET'])
@auth.login_required
def list_some_sms(kind):
    return smstools.list_some_sms(kind...

georgik avatar May 04 '20 08:05 georgik