diff --git a/logview/views.py b/logview/views.py index 24c5705..aefc2d0 100644 --- a/logview/views.py +++ b/logview/views.py @@ -24,7 +24,7 @@ from django.utils.translation import gettext as _ def get_city_by_ip(ip): try: - doc = requests.get('https://whois.pconline.com.cn/ip.jsp?ip=%s' % ip).text + doc = requests.get('https://whois.pconline.com.cn/ip.jsp?ip=%s' % ip).text.strip() city = doc.split(' ')[0] except Exception as e: city = ''