forked from roniemartinez/IPToCC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
68 lines (47 loc) · 1.7 KB
/
README
File metadata and controls
68 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
IPToCC
======
Get ISO country code of IPv4/IPv6 address. Address lookup is done
locally.
- No external API call.
- No paid GeoIP service.
Read `The Free and Simple Way To Know Who Visits Your
Site <roniemartinez.space/blog/the_free_and_simple_way_to_know_who_visits_your_site>`__.
Features
--------
- Thread-safe
Install
-------
.. code:: bash
pip install IPToCC
Usage
-----
.. code:: python
import iptocc
country_code = iptocc.get_country_code('<IPv4/IPv6 address>')
Sources
-------
- ftp://ftp.afrinic.net/stats/afrinic/delegated-afrinic-extended-latest
- ftp://ftp.arin.net/pub/stats/arin/delegated-arin-extended-latest
- ftp://ftp.apnic.net/public/apnic/stats/apnic/delegated-apnic-extended-latest
- ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest
- ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-extended-latest
Libraries Used
--------------
- `TinyDB <https://github.com/msiemens/tinydb>`__
- `UltraJSON <https://github.com/esnme/ultrajson>`__
Old implementations
-------------------
- `SQLAlchemy <https://www.sqlalchemy.org/>`__ + SQLite - Not
thread-safe
- `UnQLite <https://github.com/coleifer/unqlite-python>`__ - large
database file, problems with thread-safety
References
----------
- `RIR Statistics Exhange
Format <https://www.apnic.net/about-apnic/corporate-documents/documents/resource-guidelines/rir-statistics-exchange-format/>`__
- `How can I compile an IP address to country lookup database to make
available for
free? <https://webmasters.stackexchange.com/questions/34628/how-can-i-compile-an-ip-address-to-country-lookup-database-to-make-available-for>`__
Author
------
- `Ronie Martinez <mailto:ronmarti18@gmail.com>`__