[ANN] ip2cc-0.3: now it works with Python 2.3

D

Denis S. Otkidach

ip2cc: Lookup country country by IP address
===========================================

WHAT IS IT

If you want to gather web statistics by countries (not by top-level
domains) or implement targeting, here is solution: ip2cc. This module
allows to resolve country from IP address.

USAGE

update.py - build/update database
ip2cc.py <address> - print country name for which
<address> is registered
For example:
$ ./ip2cc.py python.org
python.org (194.109.137.226) is located in NETHERLANDS
$ ./ip2cc.py google.com.ru
google.com.ru (216.239.33.100) is located in UNITED STATES

Module can be used as CGI.

WHERE TO GET

Homepage: http://ppa.sf.net/#ip2cc
Download: http://prdownloads.sf.net/ppa/ip2cc-0.3.tar.gz?download

LICENSE

Python-style

ACKNOWLEDGEMENTS

Jason R. Mastaler
Fredrik Lundh

CHANGES

0.3 - Due to bug in bsddb module (http://python.org/sf/788421) it's
rewriten to use very simple own database.

0.2 - Adopted to new format of registrars.
- Added LACNIC to sources.
- Fixed contry code map and added -check option to simplify
maintainance.

0.1 Initial release
 
R

Richard

I get an error when trying to use it... here's the problem below:

C:\Tools>ip2cc.py www.google.com
Traceback (most recent call last):
File "C:\Tools\ip2cc.py", line 338, in ?
db = CountryByIP(db_file)
File "C:\Tools\ip2cc.py", line 14, in __init__
self.fp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'C:\\Tools\\ip2cc.db'

Looks like the database file is not included with the download.

Richard
 
S

Serge Orlov

Richard said:
I get an error when trying to use it... here's the problem below:

C:\Tools>ip2cc.py www.google.com
Traceback (most recent call last):
File "C:\Tools\ip2cc.py", line 338, in ?
db = CountryByIP(db_file)
File "C:\Tools\ip2cc.py", line 14, in __init__
self.fp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'C:\\Tools\\ip2cc.db'

Looks like the database file is not included with the download.

Try running update.py first to retrieve the database from internet.
The exception should of course be caught by ip2cc script and
a clear explanation should be printed.

-- Serge.
 
J

Jeremy Fincher

I get an error when trying to use it... here's the problem below:

C:\Tools>ip2cc.py www.google.com
Traceback (most recent call last):
File "C:\Tools\ip2cc.py", line 338, in ?
db = CountryByIP(db_file)
File "C:\Tools\ip2cc.py", line 14, in __init__
self.fp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'C:\\Tools\\ip2cc.db'

Looks like the database file is not included with the download.

Richard

That's probably why it includes update.py, a tool for
updating/building the database.

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] ip2cc 0.2 released 0

Members online

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top