我正在尝试从另一个AWS账户发布物联网消息。
我目前的情况:
根据要求,我有2个不同的AWS账户=>(1)用于工作人员,(2)用于iOT
我为工作人员提供的代码:application.py(使用boto3,python):
import boto3
import flask
from flask import request, Response
iot_client = boto3.client(
'iot-data',
aws_access_key_id='XXXXXXXX',
aws_secret_access_key='xxxxxxxxxx',
region_name='eu-west-1'
)
application = flask.Flask(__name__)
application.config.from_object('default_config')
application.debug = application.config['FLASK_DEBUG'] in ['true', 'True']
@application.route('/myworker', methods=['POST'])
def myworker():
iot_client.publish(
topic='mytopic',
qos=0,
payload= request
)
response = Response("", status=200)
我上载,部署到工作程序并发送消息到SQS,工作程序开始轮询SQS消息,但是我出错了
对于可重复项:
TypeError:“ ParamValidationError”对象不可迭代
处理WSGI脚本时发生异常 '/opt/python/current/app/application.py'。
似乎我错误地初始化了客户端,或者其他原因导致了错误。
任何建议都值得赞赏。
*******更新**********
我提取错误日志如下
[Thu Dec 27 16:06:27.425505 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:27.425517 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:32.509920 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:32.510017 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:06:32.510048 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:32.510052 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:06:32.510058 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:32.510061 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:06:32.510077 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:37.585597 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:37.585693 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:06:37.585717 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:37.585721 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:06:37.585726 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:37.585729 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:06:37.585742 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:42.682277 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:42.682377 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:06:42.682400 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:42.682404 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:06:42.682410 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:42.682413 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:42.682430 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:47.750299 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:47.750394 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:06:47.750417 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:47.750421 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:06:47.750427 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:47.750430 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:47.750443 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:52.948113 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:52.948206 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:06:52.948238 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:52.948243 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:06:52.948249 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:52.948252 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:06:52.948268 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:58.001714 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:58.001827 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:06:58.001849 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:58.001853 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:06:58.001859 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:58.001862 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:06:58.001874 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:03.047906 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:03.048017 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:03.048040 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:03.048043 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:03.048049 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:03.048052 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:03.048065 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:08.109607 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:08.109702 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:08.109723 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:08.109727 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:08.109733 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:08.109736 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:08.109748 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:13.161710 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:13.161809 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:07:13.161840 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:13.161856 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:07:13.161863 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:13.161866 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:07:13.161879 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:18.206671 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:18.206766 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:07:18.206788 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:18.206793 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:07:18.206798 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:18.206801 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:07:18.206814 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:23.270210 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:23.270305 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:23.270369 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:23.270374 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:23.270392 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:23.270395 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:23.270408 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:28.318729 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:28.318825 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:28.318848 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:28.318852 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:28.318858 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:28.318861 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:28.318873 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:33.368395 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:33.368498 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:07:33.368520 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:33.368524 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:07:33.368538 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:33.368541 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:07:33.368554 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:38.476527 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:38.476616 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:07:38.476637 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:38.476641 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:07:38.476646 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:38.476649 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:07:38.476661 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable