Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ curl -XPOST https://y5y98w7014.execute-api.ap-northeast-1.amazonaws.com:443/prod/callback -d '{"test":123}' -vvvv
- * Hostname was NOT found in DNS cache
- * Trying 54.192.213.207...
- * Connected to y5y98w7014.execute-api.ap-northeast-1.amazonaws.com (54.192.213.207) port 443 (#0)
- * successfully set certificate verify locations:
- * CAfile: none
- CApath: /etc/ssl/certs
- * SSLv3, TLS handshake, Client hello (1):
- * SSLv3, TLS handshake, Server hello (2):
- * SSLv3, TLS handshake, CERT (11):
- * SSLv3, TLS handshake, Server key exchange (12):
- * SSLv3, TLS handshake, Server finished (14):
- * SSLv3, TLS handshake, Client key exchange (16):
- * SSLv3, TLS change cipher, Client hello (1):
- * SSLv3, TLS handshake, Finished (20):
- * SSLv3, TLS change cipher, Client hello (1):
- * SSLv3, TLS handshake, Finished (20):
- * SSL connection using ECDHE-RSA-AES128-GCM-SHA256
- * Server certificate:
- * subject: C=US; ST=Washington; L=Seattle; O=Amazon.com, Inc.; CN=*.execute-api.ap-northeast-1.amazonaws.com
- * start date: 2015-09-18 00:00:00 GMT
- * expire date: 2016-09-18 23:59:59 GMT
- * subjectAltName: y5y98w7014.execute-api.ap-northeast-1.amazonaws.com matched
- * issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
- * SSL certificate verify ok.
- > POST /prod/callback HTTP/1.1
- > User-Agent: curl/7.35.0
- > Host: y5y98w7014.execute-api.ap-northeast-1.amazonaws.com
- > Accept: */*
- > Content-Length: 12
- > Content-Type: application/x-www-form-urlencoded
- >
- * upload completely sent off: 12 out of 12 bytes
- < HTTP/1.1 200 OK
- < Content-Type: application/json
- < Content-Length: 17635
- < Connection: keep-alive
- < Date: Mon, 18 Apr 2016 07:50:23 GMT
- < x-amzn-RequestId: 344e087c-053a-11e6-b701-afeb9c1258f9
- < X-Cache: Miss from cloudfront
- < Via: 1.1 7a40fffee6f7e0ce85941df41344a0da.cloudfront.net (CloudFront)
- < X-Amz-Cf-Id: ycoGOJ_kbY1lPr3p30csuiCcrAzoNl_Yd3jyEfBkzqsN7CYBJ8hArw==
- <
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title>TypeError: 'NoneType' object has no attribute '__getitem__' // Werkzeug Debugger</title>
- <link rel="stylesheet" href="?__debugger__=yes&cmd=resource&f=style.css"
- type="text/css">
- <!-- We need to make sure this has a favicon so that the debugger does
- not by accident trigger a request to /favicon.ico which might
- change the application state. -->
- <link rel="shortcut icon"
- href="?__debugger__=yes&cmd=resource&f=console.png">
- <script src="?__debugger__=yes&cmd=resource&f=jquery.js"></script>
- <script src="?__debugger__=yes&cmd=resource&f=debugger.js"></script>
- <script type="text/javascript">
- var TRACEBACK = 139642950491344,
- CONSOLE_MODE = false,
- EVALEX = true,
- EVALEX_TRUSTED = false,
- SECRET = "KievcC2cfz4I85lozymP";
- </script>
- </head>
- <body>
- <div class="debugger">
- <h1>TypeError</h1>
- <div class="detail">
- <p class="errormsg">TypeError: 'NoneType' object has no attribute '__getitem__'</p>
- </div>
- <h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
- <div class="traceback">
- <ul><li><div class="frame" id="frame-139642950491280">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1836</em>,
- in <code class="function">__call__</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>'Flask.blueprints instead'), stacklevel=2)</pre>
- <pre class="line before"><span class="ws"> </span>return self.blueprints</pre>
- <pre class="line before"><span class="ws"></span> </pre>
- <pre class="line before"><span class="ws"> </span>def __call__(self, environ, start_response):</pre>
- <pre class="line before"><span class="ws"> </span>"""Shortcut for :attr:`wsgi_app`."""</pre>
- <pre class="line current"><span class="ws"> </span>return self.wsgi_app(environ, start_response)</pre>
- <pre class="line after"><span class="ws"></span> </pre>
- <pre class="line after"><span class="ws"> </span>def __repr__(self):</pre>
- <pre class="line after"><span class="ws"> </span>return '<%s %r>' % (</pre>
- <pre class="line after"><span class="ws"> </span>self.__class__.__name__,</pre>
- <pre class="line after"><span class="ws"> </span>self.name,</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491920">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1820</em>,
- in <code class="function">wsgi_app</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>try:</pre>
- <pre class="line before"><span class="ws"> </span>try:</pre>
- <pre class="line before"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
- <pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
- <pre class="line before"><span class="ws"> </span>error = e</pre>
- <pre class="line current"><span class="ws"> </span>response = self.make_response(self.handle_exception(e))</pre>
- <pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
- <pre class="line after"><span class="ws"> </span>finally:</pre>
- <pre class="line after"><span class="ws"> </span>if self.should_ignore_error(error):</pre>
- <pre class="line after"><span class="ws"> </span>error = None</pre>
- <pre class="line after"><span class="ws"> </span>ctx.auto_pop(error)</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491984">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1403</em>,
- in <code class="function">handle_exception</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span># if we want to repropagate the exception, we can attempt to</pre>
- <pre class="line before"><span class="ws"> </span># raise it with the whole traceback in case we can do that</pre>
- <pre class="line before"><span class="ws"> </span># (the function was actually called from the except part)</pre>
- <pre class="line before"><span class="ws"> </span># otherwise, we just raise the error again</pre>
- <pre class="line before"><span class="ws"> </span>if exc_value is e:</pre>
- <pre class="line current"><span class="ws"> </span>reraise(exc_type, exc_value, tb)</pre>
- <pre class="line after"><span class="ws"> </span>else:</pre>
- <pre class="line after"><span class="ws"> </span>raise e</pre>
- <pre class="line after"><span class="ws"></span> </pre>
- <pre class="line after"><span class="ws"> </span>self.log_exception((exc_type, exc_value, tb))</pre>
- <pre class="line after"><span class="ws"> </span>if handler is None:</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491664">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1817</em>,
- in <code class="function">wsgi_app</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>ctx = self.request_context(environ)</pre>
- <pre class="line before"><span class="ws"> </span>ctx.push()</pre>
- <pre class="line before"><span class="ws"> </span>error = None</pre>
- <pre class="line before"><span class="ws"> </span>try:</pre>
- <pre class="line before"><span class="ws"> </span>try:</pre>
- <pre class="line current"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
- <pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
- <pre class="line after"><span class="ws"> </span>error = e</pre>
- <pre class="line after"><span class="ws"> </span>response = self.make_response(self.handle_exception(e))</pre>
- <pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
- <pre class="line after"><span class="ws"> </span>finally:</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491408">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1477</em>,
- in <code class="function">full_dispatch_request</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
- <pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
- <pre class="line before"><span class="ws"> </span>if rv is None:</pre>
- <pre class="line before"><span class="ws"> </span>rv = self.dispatch_request()</pre>
- <pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
- <pre class="line current"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
- <pre class="line after"><span class="ws"> </span>response = self.make_response(rv)</pre>
- <pre class="line after"><span class="ws"> </span>response = self.process_response(response)</pre>
- <pre class="line after"><span class="ws"> </span>request_finished.send(self, response=response)</pre>
- <pre class="line after"><span class="ws"> </span>return response</pre>
- <pre class="line after"><span class="ws"></span> </pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491472">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1381</em>,
- in <code class="function">handle_user_exception</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>app_handlers = self.error_handler_spec[None].get(None, ())</pre>
- <pre class="line before"><span class="ws"> </span>for typecheck, handler in chain(blueprint_handlers, app_handlers):</pre>
- <pre class="line before"><span class="ws"> </span>if isinstance(e, typecheck):</pre>
- <pre class="line before"><span class="ws"> </span>return handler(e)</pre>
- <pre class="line before"><span class="ws"></span> </pre>
- <pre class="line current"><span class="ws"> </span>reraise(exc_type, exc_value, tb)</pre>
- <pre class="line after"><span class="ws"></span> </pre>
- <pre class="line after"><span class="ws"> </span>def handle_exception(self, e):</pre>
- <pre class="line after"><span class="ws"> </span>"""Default exception handling that kicks in when an exception</pre>
- <pre class="line after"><span class="ws"> </span>occurs that is not caught. In debug mode the exception will</pre>
- <pre class="line after"><span class="ws"> </span>be re-raised immediately, otherwise it is logged and the handler</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491536">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1475</em>,
- in <code class="function">full_dispatch_request</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span>self.try_trigger_before_first_request_functions()</pre>
- <pre class="line before"><span class="ws"> </span>try:</pre>
- <pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
- <pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
- <pre class="line before"><span class="ws"> </span>if rv is None:</pre>
- <pre class="line current"><span class="ws"> </span>rv = self.dispatch_request()</pre>
- <pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
- <pre class="line after"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
- <pre class="line after"><span class="ws"> </span>response = self.make_response(rv)</pre>
- <pre class="line after"><span class="ws"> </span>response = self.process_response(response)</pre>
- <pre class="line after"><span class="ws"> </span>request_finished.send(self, response=response)</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950491600">
- <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
- line <em class="line">1461</em>,
- in <code class="function">dispatch_request</code></h4>
- <div class="source"><pre class="line before"><span class="ws"> </span># request came with the OPTIONS method, reply automatically</pre>
- <pre class="line before"><span class="ws"> </span>if getattr(rule, 'provide_automatic_options', False) \</pre>
- <pre class="line before"><span class="ws"> </span>and req.method == 'OPTIONS':</pre>
- <pre class="line before"><span class="ws"> </span>return self.make_default_options_response()</pre>
- <pre class="line before"><span class="ws"> </span># otherwise dispatch to the handler for that endpoint</pre>
- <pre class="line current"><span class="ws"> </span>return self.view_functions[rule.endpoint](**req.view_args)</pre>
- <pre class="line after"><span class="ws"></span> </pre>
- <pre class="line after"><span class="ws"> </span>def full_dispatch_request(self):</pre>
- <pre class="line after"><span class="ws"> </span>"""Dispatches the request and on top of that performs request</pre>
- <pre class="line after"><span class="ws"> </span>pre and postprocessing as well as HTTP exception catching and</pre>
- <pre class="line after"><span class="ws"> </span>error handling.</pre></div>
- </div>
- <li><div class="frame" id="frame-139642950492048">
- <h4>File <cite class="filename">"/home/amis/amis-linebot/linebot.py"</cite>,
- line <em class="line">39</em>,
- in <code class="function">line_callback</code></h4>
- <div class="source"><pre class="line before"><span class="ws"></span> </pre>
- <pre class="line before"><span class="ws"></span>@app.route('/callback', methods=['POST',])</pre>
- <pre class="line before"><span class="ws"></span>def line_callback():</pre>
- <pre class="line before"><span class="ws"> </span>app.logger.info(request.json)</pre>
- <pre class="line before"><span class="ws"> </span>app.logger.info(request.headers)</pre>
- <pre class="line current"><span class="ws"> </span>req = request.json["result"][0]</pre>
- <pre class="line after"><span class="ws"> </span>if req["eventType"] == "138311609100106403":</pre>
- <pre class="line after"><span class="ws"> </span>send_text([req["from"]], u"Nga'ayho! Mikamsia to\n謝謝你使用阿美語萌典 Line 機器人!\n")</pre>
- <pre class="line after"><span class="ws"> </span>elif req["eventType"] == "138311609000106303":</pre>
- <pre class="line after"><span class="ws"> </span>to = [req["content"]["from"]]</pre>
- <pre class="line after"><span class="ws"> </span>txt = req["content"]["text"].strip()</pre></div>
- </div>
- </ul>
- <blockquote>TypeError: 'NoneType' object has no attribute '__getitem__'</blockquote>
- </div>
- <div class="plain">
- <form action="/?__debugger__=yes&cmd=paste" method="post">
- <p>
- <input type="hidden" name="language" value="pytb">
- This is the Copy/Paste friendly version of the traceback. <span
- class="pastemessage">You can also paste this traceback into
- a <a href="https://gist.github.com/">gist</a>:
- <input type="submit" value="create paste"></span>
- </p>
- <textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
- return self.wsgi_app(environ, start_response)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
- response = self.make_response(self.handle_exception(e))
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
- reraise(exc_type, exc_value, tb)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
- response = self.full_dispatch_request()
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
- rv = self.handle_user_exception(e)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
- reraise(exc_type, exc_value, tb)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
- rv = self.dispatch_request()
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
- return self.view_functions[rule.endpoint](**req.view_args)
- File "/home/amis/amis-linebot/linebot.py", line 39, in line_callback
- req = request.json["result"][0]
- TypeError: 'NoneType' object has no attribute '__getitem__'</textarea>
- </form>
- </div>
- <div class="explanation">
- The debugger caught an exception in your WSGI application. You can now
- look at the traceback which led to the error. <span class="nojavascript">
- If you enable JavaScript you can also use additional features such as code
- execution (if the evalex feature is enabled), automatic pasting of the
- exceptions and much more.</span>
- </div>
- <div class="footer">
- Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
- friendly Werkzeug powered traceback interpreter.
- </div>
- </div>
- <div class="pin-prompt">
- <div class="inner">
- <h3>Console Locked</h3>
- <p>
- The console is locked and needs to be unlocked by entering the PIN.
- You can find the PIN printed out on the standard output of your
- shell that runs the server.
- <form>
- <p>PIN:
- <input type=text name=pin size=14>
- <input type=submit name=btn value="Confirm Pin">
- </form>
- </div>
- </div>
- </body>
- </html>
- <!--
- Traceback (most recent call last):
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
- return self.wsgi_app(environ, start_response)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
- response = self.make_response(self.handle_exception(e))
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
- reraise(exc_type, exc_value, tb)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
- response = self.full_dispatch_request()
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
- rv = self.handle_user_exception(e)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
- reraise(exc_type, exc_value, tb)
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
- rv = self.dispatch_request()
- File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
- return self.view_functions[rule.endpoint](**req.view_args)
- File "/home/amis/amis-linebot/linebot.py", line 39, in line_callback
- req = request.json["result"][0]
- TypeError: 'NoneType' object has no attribute '__getitem__'
- -->
- * Connection #0 to host y5y98w7014.execute-api.ap-northeast-1.amazonaws.com left intact
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement