This repository was archived by the owner on Jun 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +67
-52
lines changed Expand file tree Collapse file tree 8 files changed +67
-52
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPCity.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPCity.dat" , GeoIP .GEOIP_STANDARD )
6
8
7
9
gir = gi .record_by_name ("www.google.com" )
8
10
#gir = gi.record_by_addr("24.24.24.24")
9
11
10
- if gir != None :
11
- print gir ['country_code' ]
12
- print gir ['country_code3' ]
13
- print gir ['country_name' ]
14
- print gir ['city' ]
15
- print gir ['region' ]
16
- print gir ['region_name' ]
17
- print gir ['postal_code' ]
18
- print gir ['latitude' ]
19
- print gir ['longitude' ]
20
- print gir ['area_code' ]
21
- print gir ['time_zone' ]
22
- print gir ['metro_code' ]
23
- print str (gir )
12
+ if gir is not None :
13
+ print ( gir ['country_code' ])
14
+ print ( gir ['country_code3' ])
15
+ print ( gir ['country_name' ])
16
+ print ( gir ['city' ])
17
+ print ( gir ['region' ])
18
+ print ( gir ['region_name' ])
19
+ print ( gir ['postal_code' ])
20
+ print ( gir ['latitude' ])
21
+ print ( gir ['longitude' ])
22
+ print ( gir ['area_code' ])
23
+ print ( gir ['time_zone' ])
24
+ print ( gir ['metro_code' ])
25
+ print ( str (gir ) )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
7
#gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
6
8
#gi = GeoIP.new(GeoIP.GEOIP_MMAP_CACHE)
7
9
gi = GeoIP .new (GeoIP .GEOIP_MEMORY_CACHE )
8
10
#gi = GeoIP.open("/usr/local/share/GeoIP/GeoIP.dat",GeoIP.GEOIP_STANDARD)
9
11
10
- print gi .country_code_by_name ("yahoo.com" )
11
- print gi .last_netmask ()
12
- print gi .country_name_by_name ("www.bundestag.de" )
13
- print gi .country_code_by_addr ("24.24.24.24" )
14
- print gi .country_name_by_addr ("24.24.24.24" )
15
- print gi .range_by_ip ("68.180.206.184" )
16
-
12
+ print (gi .country_code_by_name ("yahoo.com" ))
13
+ print (gi .last_netmask ())
14
+ print (gi .country_name_by_name ("www.bundestag.de" ))
15
+ print (gi .country_code_by_addr ("24.24.24.24" ))
16
+ print (gi .country_name_by_addr ("24.24.24.24" ))
17
+ print (gi .range_by_ip ("68.180.206.184" ))
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPDomain.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPDomain.dat" , GeoIP .GEOIP_STANDARD )
6
8
7
- print gi .org_by_addr ("24.24.24.24" )
9
+ print ( gi .org_by_addr ("24.24.24.24" ) )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPNetspeed.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open (
8
+ "/usr/local/share/GeoIP/GeoIPNetspeed.dat" , GeoIP .GEOIP_STANDARD )
6
9
7
10
# GEOIP_UNKNOWN_SPEED, GEOIP_DIALUP_SPEED, GEOIP_CABLEDSL_SPEED or
8
11
# GEOIP_CORPORATE_SPEED
9
12
10
- print gi .id_by_name ("yahoo.com" )
11
- print gi .id_by_name ("www.maxmind.com" ) == GeoIP .GEOIP_UNKNOWN_SPEED
12
- print gi .id_by_addr ("203.195.93.0" )
13
+ print ( gi .id_by_name ("yahoo.com" ) )
14
+ print ( gi .id_by_name ("www.maxmind.com" ) == GeoIP .GEOIP_UNKNOWN_SPEED )
15
+ print ( gi .id_by_addr ("203.195.93.0" ) )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPNetSpeedCell.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open (
8
+ "/usr/local/share/GeoIP/GeoIPNetSpeedCell.dat" , GeoIP .GEOIP_STANDARD )
6
9
7
- print gi .org_by_name ("yahoo.com" )
8
- print gi .org_by_name ("www.google.com" )
9
- print gi .org_by_addr ("24.24.24.24" )
10
+ print ( gi .org_by_name ("yahoo.com" ) )
11
+ print ( gi .org_by_name ("www.google.com" ) )
12
+ print ( gi .org_by_addr ("24.24.24.24" ) )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPOrg.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPOrg.dat" , GeoIP .GEOIP_STANDARD )
6
8
7
- print gi .org_by_name ("yahoo.com" )
8
- print gi .org_by_name ("www.google.com" )
9
- print gi .org_by_addr ("24.24.24.24" )
9
+ print ( gi .org_by_name ("yahoo.com" ) )
10
+ print ( gi .org_by_name ("www.google.com" ) )
11
+ print ( gi .org_by_addr ("24.24.24.24" ) )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPRegion.dat" ,GeoIP .GEOIP_STANDARD )
7
+ gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPRegion.dat" , GeoIP .GEOIP_STANDARD )
6
8
7
9
gir = gi .region_by_name ("www.google.com" )
8
- if gir != None :
9
- print gir ['country_code' ]
10
+ if gir is not None :
11
+ print ( gir ['country_code' ])
10
12
11
- print gir ['region' ]
12
- print gir ['region_name' ]
13
+ print ( gir ['region' ])
14
+ print ( gir ['region_name' ])
13
15
gir = gi .region_by_addr ("24.24.24.24" )
14
- if gir != None :
15
- print gir ['country_code' ]
16
- print gir ['region' ]
17
- print gir ['region_name' ]
18
-
16
+ if gir is not None :
17
+ print (gir ['country_code' ])
18
+ print (gir ['region' ])
19
+ print (gir ['region_name' ])
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
+ from __future__ import print_function
4
+
3
5
import GeoIP
4
6
5
7
#gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
6
8
#gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
7
- gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPv6.dat" ,GeoIP .GEOIP_STANDARD )
8
-
9
- print gi .country_code_by_name_v6 ("ipv6.google.com" )
10
- print gi .country_name_by_name_v6 ("ipv6.google.com" )
11
- print gi .country_code_by_addr_v6 ("2001:4860:0:1001::68" )
12
- print gi .country_name_by_addr_v6 ("2001:4860:0:1001::68" )
9
+ gi = GeoIP .open ("/usr/local/share/GeoIP/GeoIPv6.dat" , GeoIP .GEOIP_STANDARD )
13
10
11
+ print (gi .country_code_by_name_v6 ("ipv6.google.com" ))
12
+ print (gi .country_name_by_name_v6 ("ipv6.google.com" ))
13
+ print (gi .country_code_by_addr_v6 ("2001:4860:0:1001::68" ))
14
+ print (gi .country_name_by_addr_v6 ("2001:4860:0:1001::68" ))
You can’t perform that action at this time.
0 commit comments