lvasiliev / smstools-http-api Goto Github PK
View Code? Open in Web Editor NEWHTTP API for smstools3
License: MIT License
HTTP API for smstools3
License: MIT License
When trying to send my first SMS via command entered directly from readme.md
I am getting either python recursion error (mentioned in other issue) or a webpage with error:
IOError: [Errno 2] No such file or directory: 'tmp/outgoing/40fabae2-7edb-4092-a603-d580da0fece7.LOCK'
The full error dump is:
IOError
IOError: [Errno 2] No such file or directory: 'tmp/outgoing/40fabae2-7edb-4092-a603-d580da0fece7.LOCK'
Traceback (most recent call last)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/flask_httpauth.py", line 105, in decorated
return f(*args, **kwargs)
File "/root/smstools-http-api-master/app/api_1_0/views.py", line 76, in outgoing_view
result = send_sms(data)
File "/root/smstools-http-api-master/app/api_1_0/smstools.py", line 160, in send_sms
with open(lock_file, write_mode) as fp:
IOError: [Errno 2] No such file or directory: 'tmp/outgoing/40fabae2-7edb-4092-a603-d580da0fece7.LOCK'
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Hello,
Thanks for this code. It works well. I would like to know whether you could add a REST method to delete/remove message, in incoming directory.
That will be something like this
DELETE /api/v1.0/sms//string:message_id
I'm willing to help, but i don't know very well how to code.
Regards
Thomas
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
Polish letter ó in sms showing as a "chinese character".
When installed like in readme.md after creating a local server it does NOT work, returning error "unauthorized" 401 upon entering the commands listed in the readme. There is some user mentioned in the curl command listed
curl -u lvv:SecretPAss -i -H "Content-Type: application/json; charset=UTF-8" -d '{"text":"Hi, Jack!", "mobiles":["79680000000", "79160000000"]}' http://127.0.0.1:5000/api/v1.0/sms/outgoing
there is no information where shall I define the luv user with pass SecretPAss.
Hi, I had to remove this check in our fork because:
From
field indicating sender's phone number.What is your use-case?
When I try to run this on Ubuntu18.04 I get a stack trace and the message
AttributeError: 'Blueprint' object has no attribute 'json_encoder'
every time I try to send something via http://127.0.0.1:5000/api/v1.0/sms/outgoing
. I'm using the curl command from the examples given, with a different mobile number obviously.
Full Trace follows:
Traceback (most recent call last):
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask_httpauth.py", line 91, in decorated
return self.auth_error_callback()
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask_httpauth.py", line 43, in decorated
res = f(*args, **kwargs)
File "/root/smstools-http-api/app/api_1_0/authentication.py", line 30, in auth_error
return unauthorized('Unauthorized access')
File "/root/smstools-http-api/app/api_1_0/errors.py", line 17, in unauthorized
response = jsonify(response)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/json/__init__.py", line 321, in jsonify
dumps(data, indent=indent, separators=separators) + '\n',
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/json/__init__.py", line 177, in dumps
_dump_arg_defaults(kwargs)
File "/root/smstools-http-api/venv/lib/python3.6/site-packages/flask/json/__init__.py", line 98, in _dump_arg_defaults
bp.json_encoder if bp and bp.json_encoder
AttributeError: 'Blueprint' object has no attribute 'json_encoder'
Hello,
is any simple way to add SMS report status into GET /api/v1.0/sms/<kind>/<string:message_id>
?
Report files contains Message_id and Status. Sent SMS files contains a Message_id
SMS STATUS REPORT
Message_id: 35
Discharge_timestamp: 17-08-25 02:41:58
Status: 0,Ok,short message received by the SME
Thank You
Hi,
in the first way I would like to thank you for such great upgrade over smstools.
I have prepared the APIARY doc for the API, maybe it will be handy for other users:
https://smstoolshttpapi.docs.apiary.io
Thanks again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.