Skip to content

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

@Waterman1997

Description

@Waterman1997

建议优化下写法

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,巴啦啦报错

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions