Completed
Push — master ( 091708...b877bb )
by Ryan
01:13
created

ip_asn()   A

Complexity

Conditions 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
1
from geoip2.errors import AddressNotFoundError
2
3
4
def ip_asn(app, ip):
5
    try:
6
        reader = app.config.get("trdb").get("mmdb")
7
    except:
8
        return None
9
10
    try:
11
        ret = reader.isp(ip)
12
    except AddressNotFoundError:
13
        return None
14
15
    return ret
16