Skip to content

Commit 5ecbfa4

Browse files
committed
fix UnicodeEncodeError
1 parent eff422a commit 5ecbfa4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ip_info.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import urllib2
55
import json
66
import sys
7+
reload(sys)
8+
sys.setdefaultencoding('utf-8')
79

810
ip_api = urllib2.urlopen(r'http://ip-api.com/json')
911

0 commit comments

Comments
 (0)