Advertisement
Guest User

Untitled

a guest
Apr 18th, 2016
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.49 KB | None | 0 0
  1. $ curl -XPOST https://y5y98w7014.execute-api.ap-northeast-1.amazonaws.com:443/prod/callback -d '{"test":123}' -vvvv
  2. * Hostname was NOT found in DNS cache
  3. * Trying 54.192.213.207...
  4. * Connected to y5y98w7014.execute-api.ap-northeast-1.amazonaws.com (54.192.213.207) port 443 (#0)
  5. * successfully set certificate verify locations:
  6. * CAfile: none
  7. CApath: /etc/ssl/certs
  8. * SSLv3, TLS handshake, Client hello (1):
  9. * SSLv3, TLS handshake, Server hello (2):
  10. * SSLv3, TLS handshake, CERT (11):
  11. * SSLv3, TLS handshake, Server key exchange (12):
  12. * SSLv3, TLS handshake, Server finished (14):
  13. * SSLv3, TLS handshake, Client key exchange (16):
  14. * SSLv3, TLS change cipher, Client hello (1):
  15. * SSLv3, TLS handshake, Finished (20):
  16. * SSLv3, TLS change cipher, Client hello (1):
  17. * SSLv3, TLS handshake, Finished (20):
  18. * SSL connection using ECDHE-RSA-AES128-GCM-SHA256
  19. * Server certificate:
  20. * subject: C=US; ST=Washington; L=Seattle; O=Amazon.com, Inc.; CN=*.execute-api.ap-northeast-1.amazonaws.com
  21. * start date: 2015-09-18 00:00:00 GMT
  22. * expire date: 2016-09-18 23:59:59 GMT
  23. * subjectAltName: y5y98w7014.execute-api.ap-northeast-1.amazonaws.com matched
  24. * issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
  25. * SSL certificate verify ok.
  26. > POST /prod/callback HTTP/1.1
  27. > User-Agent: curl/7.35.0
  28. > Host: y5y98w7014.execute-api.ap-northeast-1.amazonaws.com
  29. > Accept: */*
  30. > Content-Length: 12
  31. > Content-Type: application/x-www-form-urlencoded
  32. >
  33. * upload completely sent off: 12 out of 12 bytes
  34. < HTTP/1.1 200 OK
  35. < Content-Type: application/json
  36. < Content-Length: 17635
  37. < Connection: keep-alive
  38. < Date: Mon, 18 Apr 2016 07:50:23 GMT
  39. < x-amzn-RequestId: 344e087c-053a-11e6-b701-afeb9c1258f9
  40. < X-Cache: Miss from cloudfront
  41. < Via: 1.1 7a40fffee6f7e0ce85941df41344a0da.cloudfront.net (CloudFront)
  42. < X-Amz-Cf-Id: ycoGOJ_kbY1lPr3p30csuiCcrAzoNl_Yd3jyEfBkzqsN7CYBJ8hArw==
  43. <
  44. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  45. "http://www.w3.org/TR/html4/loose.dtd">
  46. <html>
  47. <head>
  48. <title>TypeError: 'NoneType' object has no attribute '__getitem__' // Werkzeug Debugger</title>
  49. <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css"
  50. type="text/css">
  51. <!-- We need to make sure this has a favicon so that the debugger does
  52. not by accident trigger a request to /favicon.ico which might
  53. change the application state. -->
  54. <link rel="shortcut icon"
  55. href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
  56. <script src="?__debugger__=yes&amp;cmd=resource&amp;f=jquery.js"></script>
  57. <script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
  58. <script type="text/javascript">
  59. var TRACEBACK = 139642950491344,
  60. CONSOLE_MODE = false,
  61. EVALEX = true,
  62. EVALEX_TRUSTED = false,
  63. SECRET = "KievcC2cfz4I85lozymP";
  64. </script>
  65. </head>
  66. <body>
  67. <div class="debugger">
  68. <h1>TypeError</h1>
  69. <div class="detail">
  70. <p class="errormsg">TypeError: 'NoneType' object has no attribute '__getitem__'</p>
  71. </div>
  72. <h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
  73. <div class="traceback">
  74.  
  75. <ul><li><div class="frame" id="frame-139642950491280">
  76. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  77. line <em class="line">1836</em>,
  78. in <code class="function">__call__</code></h4>
  79. <div class="source"><pre class="line before"><span class="ws"> </span>'Flask.blueprints instead'), stacklevel=2)</pre>
  80. <pre class="line before"><span class="ws"> </span>return self.blueprints</pre>
  81. <pre class="line before"><span class="ws"></span> </pre>
  82. <pre class="line before"><span class="ws"> </span>def __call__(self, environ, start_response):</pre>
  83. <pre class="line before"><span class="ws"> </span>&quot;&quot;&quot;Shortcut for :attr:`wsgi_app`.&quot;&quot;&quot;</pre>
  84. <pre class="line current"><span class="ws"> </span>return self.wsgi_app(environ, start_response)</pre>
  85. <pre class="line after"><span class="ws"></span> </pre>
  86. <pre class="line after"><span class="ws"> </span>def __repr__(self):</pre>
  87. <pre class="line after"><span class="ws"> </span>return '&lt;%s %r&gt;' % (</pre>
  88. <pre class="line after"><span class="ws"> </span>self.__class__.__name__,</pre>
  89. <pre class="line after"><span class="ws"> </span>self.name,</pre></div>
  90. </div>
  91.  
  92. <li><div class="frame" id="frame-139642950491920">
  93. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  94. line <em class="line">1820</em>,
  95. in <code class="function">wsgi_app</code></h4>
  96. <div class="source"><pre class="line before"><span class="ws"> </span>try:</pre>
  97. <pre class="line before"><span class="ws"> </span>try:</pre>
  98. <pre class="line before"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
  99. <pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
  100. <pre class="line before"><span class="ws"> </span>error = e</pre>
  101. <pre class="line current"><span class="ws"> </span>response = self.make_response(self.handle_exception(e))</pre>
  102. <pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
  103. <pre class="line after"><span class="ws"> </span>finally:</pre>
  104. <pre class="line after"><span class="ws"> </span>if self.should_ignore_error(error):</pre>
  105. <pre class="line after"><span class="ws"> </span>error = None</pre>
  106. <pre class="line after"><span class="ws"> </span>ctx.auto_pop(error)</pre></div>
  107. </div>
  108.  
  109. <li><div class="frame" id="frame-139642950491984">
  110. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  111. line <em class="line">1403</em>,
  112. in <code class="function">handle_exception</code></h4>
  113. <div class="source"><pre class="line before"><span class="ws"> </span># if we want to repropagate the exception, we can attempt to</pre>
  114. <pre class="line before"><span class="ws"> </span># raise it with the whole traceback in case we can do that</pre>
  115. <pre class="line before"><span class="ws"> </span># (the function was actually called from the except part)</pre>
  116. <pre class="line before"><span class="ws"> </span># otherwise, we just raise the error again</pre>
  117. <pre class="line before"><span class="ws"> </span>if exc_value is e:</pre>
  118. <pre class="line current"><span class="ws"> </span>reraise(exc_type, exc_value, tb)</pre>
  119. <pre class="line after"><span class="ws"> </span>else:</pre>
  120. <pre class="line after"><span class="ws"> </span>raise e</pre>
  121. <pre class="line after"><span class="ws"></span> </pre>
  122. <pre class="line after"><span class="ws"> </span>self.log_exception((exc_type, exc_value, tb))</pre>
  123. <pre class="line after"><span class="ws"> </span>if handler is None:</pre></div>
  124. </div>
  125.  
  126. <li><div class="frame" id="frame-139642950491664">
  127. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  128. line <em class="line">1817</em>,
  129. in <code class="function">wsgi_app</code></h4>
  130. <div class="source"><pre class="line before"><span class="ws"> </span>ctx = self.request_context(environ)</pre>
  131. <pre class="line before"><span class="ws"> </span>ctx.push()</pre>
  132. <pre class="line before"><span class="ws"> </span>error = None</pre>
  133. <pre class="line before"><span class="ws"> </span>try:</pre>
  134. <pre class="line before"><span class="ws"> </span>try:</pre>
  135. <pre class="line current"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
  136. <pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
  137. <pre class="line after"><span class="ws"> </span>error = e</pre>
  138. <pre class="line after"><span class="ws"> </span>response = self.make_response(self.handle_exception(e))</pre>
  139. <pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
  140. <pre class="line after"><span class="ws"> </span>finally:</pre></div>
  141. </div>
  142.  
  143. <li><div class="frame" id="frame-139642950491408">
  144. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  145. line <em class="line">1477</em>,
  146. in <code class="function">full_dispatch_request</code></h4>
  147. <div class="source"><pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
  148. <pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
  149. <pre class="line before"><span class="ws"> </span>if rv is None:</pre>
  150. <pre class="line before"><span class="ws"> </span>rv = self.dispatch_request()</pre>
  151. <pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
  152. <pre class="line current"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
  153. <pre class="line after"><span class="ws"> </span>response = self.make_response(rv)</pre>
  154. <pre class="line after"><span class="ws"> </span>response = self.process_response(response)</pre>
  155. <pre class="line after"><span class="ws"> </span>request_finished.send(self, response=response)</pre>
  156. <pre class="line after"><span class="ws"> </span>return response</pre>
  157. <pre class="line after"><span class="ws"></span> </pre></div>
  158. </div>
  159.  
  160. <li><div class="frame" id="frame-139642950491472">
  161. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  162. line <em class="line">1381</em>,
  163. in <code class="function">handle_user_exception</code></h4>
  164. <div class="source"><pre class="line before"><span class="ws"> </span>app_handlers = self.error_handler_spec[None].get(None, ())</pre>
  165. <pre class="line before"><span class="ws"> </span>for typecheck, handler in chain(blueprint_handlers, app_handlers):</pre>
  166. <pre class="line before"><span class="ws"> </span>if isinstance(e, typecheck):</pre>
  167. <pre class="line before"><span class="ws"> </span>return handler(e)</pre>
  168. <pre class="line before"><span class="ws"></span> </pre>
  169. <pre class="line current"><span class="ws"> </span>reraise(exc_type, exc_value, tb)</pre>
  170. <pre class="line after"><span class="ws"></span> </pre>
  171. <pre class="line after"><span class="ws"> </span>def handle_exception(self, e):</pre>
  172. <pre class="line after"><span class="ws"> </span>&quot;&quot;&quot;Default exception handling that kicks in when an exception</pre>
  173. <pre class="line after"><span class="ws"> </span>occurs that is not caught. In debug mode the exception will</pre>
  174. <pre class="line after"><span class="ws"> </span>be re-raised immediately, otherwise it is logged and the handler</pre></div>
  175. </div>
  176.  
  177. <li><div class="frame" id="frame-139642950491536">
  178. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  179. line <em class="line">1475</em>,
  180. in <code class="function">full_dispatch_request</code></h4>
  181. <div class="source"><pre class="line before"><span class="ws"> </span>self.try_trigger_before_first_request_functions()</pre>
  182. <pre class="line before"><span class="ws"> </span>try:</pre>
  183. <pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
  184. <pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
  185. <pre class="line before"><span class="ws"> </span>if rv is None:</pre>
  186. <pre class="line current"><span class="ws"> </span>rv = self.dispatch_request()</pre>
  187. <pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
  188. <pre class="line after"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
  189. <pre class="line after"><span class="ws"> </span>response = self.make_response(rv)</pre>
  190. <pre class="line after"><span class="ws"> </span>response = self.process_response(response)</pre>
  191. <pre class="line after"><span class="ws"> </span>request_finished.send(self, response=response)</pre></div>
  192. </div>
  193.  
  194. <li><div class="frame" id="frame-139642950491600">
  195. <h4>File <cite class="filename">"/usr/local/lib/python2.7/dist-packages/flask/app.py"</cite>,
  196. line <em class="line">1461</em>,
  197. in <code class="function">dispatch_request</code></h4>
  198. <div class="source"><pre class="line before"><span class="ws"> </span># request came with the OPTIONS method, reply automatically</pre>
  199. <pre class="line before"><span class="ws"> </span>if getattr(rule, 'provide_automatic_options', False) \</pre>
  200. <pre class="line before"><span class="ws"> </span>and req.method == 'OPTIONS':</pre>
  201. <pre class="line before"><span class="ws"> </span>return self.make_default_options_response()</pre>
  202. <pre class="line before"><span class="ws"> </span># otherwise dispatch to the handler for that endpoint</pre>
  203. <pre class="line current"><span class="ws"> </span>return self.view_functions[rule.endpoint](**req.view_args)</pre>
  204. <pre class="line after"><span class="ws"></span> </pre>
  205. <pre class="line after"><span class="ws"> </span>def full_dispatch_request(self):</pre>
  206. <pre class="line after"><span class="ws"> </span>&quot;&quot;&quot;Dispatches the request and on top of that performs request</pre>
  207. <pre class="line after"><span class="ws"> </span>pre and postprocessing as well as HTTP exception catching and</pre>
  208. <pre class="line after"><span class="ws"> </span>error handling.</pre></div>
  209. </div>
  210.  
  211. <li><div class="frame" id="frame-139642950492048">
  212. <h4>File <cite class="filename">"/home/amis/amis-linebot/linebot.py"</cite>,
  213. line <em class="line">39</em>,
  214. in <code class="function">line_callback</code></h4>
  215. <div class="source"><pre class="line before"><span class="ws"></span> </pre>
  216. <pre class="line before"><span class="ws"></span>@app.route('/callback', methods=['POST',])</pre>
  217. <pre class="line before"><span class="ws"></span>def line_callback():</pre>
  218. <pre class="line before"><span class="ws"> </span>app.logger.info(request.json)</pre>
  219. <pre class="line before"><span class="ws"> </span>app.logger.info(request.headers)</pre>
  220. <pre class="line current"><span class="ws"> </span>req = request.json[&quot;result&quot;][0]</pre>
  221. <pre class="line after"><span class="ws"> </span>if req[&quot;eventType&quot;] == &quot;138311609100106403&quot;:</pre>
  222. <pre class="line after"><span class="ws"> </span>send_text([req[&quot;from&quot;]], u&quot;Nga'ayho! Mikamsia to\n謝謝你使用阿美語萌典 Line 機器人!\n&quot;)</pre>
  223. <pre class="line after"><span class="ws"> </span>elif req[&quot;eventType&quot;] == &quot;138311609000106303&quot;:</pre>
  224. <pre class="line after"><span class="ws"> </span>to = [req[&quot;content&quot;][&quot;from&quot;]]</pre>
  225. <pre class="line after"><span class="ws"> </span>txt = req[&quot;content&quot;][&quot;text&quot;].strip()</pre></div>
  226. </div>
  227. </ul>
  228. <blockquote>TypeError: 'NoneType' object has no attribute '__getitem__'</blockquote>
  229. </div>
  230.  
  231. <div class="plain">
  232. <form action="/?__debugger__=yes&amp;cmd=paste" method="post">
  233. <p>
  234. <input type="hidden" name="language" value="pytb">
  235. This is the Copy/Paste friendly version of the traceback. <span
  236. class="pastemessage">You can also paste this traceback into
  237. a <a href="https://gist.github.com/">gist</a>:
  238. <input type="submit" value="create paste"></span>
  239. </p>
  240. <textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
  241. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
  242. return self.wsgi_app(environ, start_response)
  243. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
  244. response = self.make_response(self.handle_exception(e))
  245. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
  246. reraise(exc_type, exc_value, tb)
  247. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
  248. response = self.full_dispatch_request()
  249. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
  250. rv = self.handle_user_exception(e)
  251. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
  252. reraise(exc_type, exc_value, tb)
  253. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
  254. rv = self.dispatch_request()
  255. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
  256. return self.view_functions[rule.endpoint](**req.view_args)
  257. File "/home/amis/amis-linebot/linebot.py", line 39, in line_callback
  258. req = request.json["result"][0]
  259. TypeError: 'NoneType' object has no attribute '__getitem__'</textarea>
  260. </form>
  261. </div>
  262. <div class="explanation">
  263. The debugger caught an exception in your WSGI application. You can now
  264. look at the traceback which led to the error. <span class="nojavascript">
  265. If you enable JavaScript you can also use additional features such as code
  266. execution (if the evalex feature is enabled), automatic pasting of the
  267. exceptions and much more.</span>
  268. </div>
  269. <div class="footer">
  270. Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
  271. friendly Werkzeug powered traceback interpreter.
  272. </div>
  273. </div>
  274.  
  275. <div class="pin-prompt">
  276. <div class="inner">
  277. <h3>Console Locked</h3>
  278. <p>
  279. The console is locked and needs to be unlocked by entering the PIN.
  280. You can find the PIN printed out on the standard output of your
  281. shell that runs the server.
  282. <form>
  283. <p>PIN:
  284. <input type=text name=pin size=14>
  285. <input type=submit name=btn value="Confirm Pin">
  286. </form>
  287. </div>
  288. </div>
  289. </body>
  290. </html>
  291.  
  292. <!--
  293.  
  294. Traceback (most recent call last):
  295. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
  296. return self.wsgi_app(environ, start_response)
  297. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
  298. response = self.make_response(self.handle_exception(e))
  299. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
  300. reraise(exc_type, exc_value, tb)
  301. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
  302. response = self.full_dispatch_request()
  303. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
  304. rv = self.handle_user_exception(e)
  305. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
  306. reraise(exc_type, exc_value, tb)
  307. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
  308. rv = self.dispatch_request()
  309. File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
  310. return self.view_functions[rule.endpoint](**req.view_args)
  311. File "/home/amis/amis-linebot/linebot.py", line 39, in line_callback
  312. req = request.json["result"][0]
  313. TypeError: 'NoneType' object has no attribute '__getitem__'
  314.  
  315. -->
  316. * Connection #0 to host y5y98w7014.execute-api.ap-northeast-1.amazonaws.com left intact
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement