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

建议优化下ip-api.com的请求方式 #17

Open
Waterman1997 opened this issue Nov 26, 2019 · 0 comments
Open

建议优化下ip-api.com的请求方式 #17

Waterman1997 opened this issue Nov 26, 2019 · 0 comments

Comments

@Waterman1997
Copy link

建议优化下写法

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

例如

try:
    urllib2.urlopen(r'http://ip-api.com/json')
except urllib2.URLError as e:
    print e.code

原因是我的pi-hole默认屏蔽规则里有这个域名,so,巴啦啦报错

@Waterman1997 Waterman1997 changed the title 建议优化下请求方式ip-api.com的请求方式 建议优化下ip-api.com的请求方式 Nov 26, 2019
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