在运行代码时
data = urllib.urlencode(parameters)
req = urllib2.Request(url, data)
logging.info('shivaniHAHOHJSJKDNVJNCMBVJDCVHJSHHHHEKLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
logging.info(data)
try:
response = urllib2.urlopen(req)
except urllib2.URLError, e:
self.redirect('/error')
json_post = response.read()
data = json.loads(json_post)
self.redirect('/'+str(data))
response_dict = simplejson.loads(json_post)
virustotal = VirusTotal()
logging.info('1111111111111111111111111111111111111111111111111')
logging.info('result')
logging.info(data[int('result')])
if data ['result'] == 0:
virustotal_result = True
我在我的日志文件中得到关注
ValueError: invalid literal for int() with base 10: 'result'
INFO 2013-05-07 12:14:19,142 server.py:561] default: "GET /query? url=abc.com&submit=Scan HTTP/1.1" 500 -
INFO 2013-05-07 12:16:01,857 server.py:561] default: "GET / HTTP/1.1" 200 1236
INFO 2013-05-07 12:16:01,894 server.py:561] default: "GET /images/logo.png HTTP/1.1" 304 -
INFO 2013-05-07 12:16:01,898 server.py:561] default: "GET /css/cssscript.css HTTP/1.1" 304 -
INFO 2013-05-07 12:16:01,943 server.py:561] default: "GET /images/left.png HTTP/1.1" 304 -
INFO 2013-05-07 12:16:01,950 server.py:561] default: "GET /images/right.png HTTP/1.1" 304 -
INFO 2013-05-07 12:16:01,950 server.py:561] default: "GET /images/bg.png HTTP/1.1" 304 -
INFO 2013-05-07 12:16:02,065 server.py:561] default: "GET /favicon.ico HTTP/1.1" 404 154
WARNING 2013-05-07 12:16:10,082 urlfetch_stub.py:453] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
INFO 2013-05-07 19:16:23,915 main.py:420] shivaniHAHOHJSJKDNVJNCMBVJDCVHJSHHHHEKLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO 2013-05-07 19:16:23,917 main.py:421] resource=http%3A%2F%2Fgoogle.com&scan=1&key=b99eeaddac6ef5cf62746beffd71f1e16708b6db6085de243f050e241c6c671f
WARNING 2013-05-07 12:16:23,924 urlfetch_stub.py:453] Stripped prohibited headers from URLFetch request: ['Content-Length', 'Host']
INFO 2013-05-07 19:16:33,023 main.py:432] 1111111111111111111111111111111111111111111111111
INFO 2013-05-07 19:16:33,026 main.py:433] result
ERROR 2013-05-07 19:16:33,028 webapp2.py:1528] invalid literal for int() with base 10: 'result'
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\Shivani\Desktop\malbee-phish (1)\main.py", line 434, in get
logging.info(data[int('result')])
ValueError: invalid literal for int() with base 10: 'result'
可能是什么原因..??如果我在没有 int() 的情况下尝试 data['result'] 它会给我以下错误 TypeError: list indices must be integers, not str