Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'alpha_2' #7

Open
thereporter42 opened this issue Jun 26, 2018 · 0 comments
Open

KeyError: 'alpha_2' #7

thereporter42 opened this issue Jun 26, 2018 · 0 comments

Comments

@thereporter42
Copy link

thereporter42 commented Jun 26, 2018

Ok everything was setup and was working with the log viewer and now all of a sudden
today I am getting a key error.

The only time I get this error is when I go to Statistics and then attacks by country.

Like I said it was working fine now today I am getting this..

Running Debian 9

uname -a
Linux server1 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

python -V
Python 2.7.13

pip install -r requirements.txt
Requirement already satisfied: flask in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied: ipapi in /usr/local/lib/python2.7/dist-packages/ipapi-0.5.2-py2.7.egg (from -r requirements.txt (line 2))
Requirement already satisfied: pycountry in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 3))
Requirement already satisfied: path.py in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 4))
Requirement already satisfied: flask-compress in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 5))
Requirement already satisfied: python-dateutil in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 6))
Requirement already satisfied: geoip2 in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 7))
Requirement already satisfied: requests[security] in /usr/lib/python2.7/dist-packages (from ipapi->-r requirements.txt (line 2))
Requirement already satisfied: ipaddress in /usr/lib/python2.7/dist-packages (from geoip2->-r requirements.txt (line 7))
Requirement already satisfied: pyOpenSSL>=0.14 in /usr/lib/python2.7/dist-packages (from requests[security]->ipapi->-r requirements.txt (line 2))
Requirement already satisfied: cryptography>=1.3.4 in /usr/lib/python2.7/dist-packages (from requests[security]->ipapi->-r requirements.txt (line 2))
Requirement already satisfied: idna>=2.0.0 in /usr/lib/python2.7/dist-packages (from requests[security]->ipapi->-r requirements.txt (line 2))

This was the dump that I got

KeyError

KeyError: 'alpha_2'
Traceback (most recent call last)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app

response = self.handle_exception(e)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/home/cowrie/cowrie-logviewer/cowrie-logviewer.py", line 147, in show_stats_countries

tmp = [ pycountry.countries.get(alpha_2=country[0]).name, country[0], country[1] ]

File "/usr/lib/python2.7/dist-packages/pycountry/db.py", line 123, in get

return self.indices[field][value]

KeyError: 'alpha_2'

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant