https://github.com/ehco1996/ipicn
A tool to help determine whether ip is in China.
https://github.com/ehco1996/ipicn
Last synced: 8 months ago
JSON representation
A tool to help determine whether ip is in China.
- Host: GitHub
- URL: https://github.com/ehco1996/ipicn
- Owner: Ehco1996
- License: gpl-3.0
- Created: 2021-05-05T07:26:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-05T07:47:47.000Z (over 4 years ago)
- Last Synced: 2025-04-13T00:54:05.525Z (8 months ago)
- Language: Python
- Size: 33.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipicn
A tool to help determine whether ip is in China.
## Explain
ipicn use GeoDatabase: `[GeoIP2-CN](https://github.com/Hackl0us/GeoIP2-CN)` to find ip location.
It only provide one api to judge you input ip/domain is in China.
## Install
`pip install ipicn`
Note that `ipicn` will download geo database from `https://github.com/Hackl0us/GeoIP2-CN/raw/release/Country.mmdb` if the current directory not contains this file.
if you want to update the latest database, just remove `Country.mmdb` and restart your program, or you can use `is_in_china(ip, update_database=True)`
## Example
``` python
from ipicn import is_in_china
is_in_china("www.baidu.com")
>> True
is_in_china("www.google.com")
>> False
# force update geo database
is_in_china(www.google.com, update_database=True)
>> False
```