3.0.2 with python >= 3.7 supports
This commit is contained in:
parent
6eee95967b
commit
aa5437c637
|
|
@ -1,5 +1,8 @@
|
||||||
# ip2region xdb python 查询客户端实现
|
# ip2region xdb python 查询客户端实现
|
||||||
|
|
||||||
|
# 版本兼容
|
||||||
|
该实现兼容 Python `>=` **`3.7`**
|
||||||
|
|
||||||
# 使用方式
|
# 使用方式
|
||||||
|
|
||||||
### 安装 `py-ip2region`
|
### 安装 `py-ip2region`
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import ip2region.util as util
|
import ip2region.util as util
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
class Searcher(object):
|
class Searcher(object):
|
||||||
'''
|
'''
|
||||||
|
|
@ -33,7 +34,7 @@ class Searcher(object):
|
||||||
def get_io_count(self):
|
def get_io_count(self):
|
||||||
return self.__io_count
|
return self.__io_count
|
||||||
|
|
||||||
def search(self, ip: bytes | str):
|
def search(self, ip: Union[bytes, str]):
|
||||||
# check and parse the string ip
|
# check and parse the string ip
|
||||||
ip_bytes = None
|
ip_bytes = None
|
||||||
if isinstance(ip, str):
|
if isinstance(ip, str):
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import ipaddress
|
import ipaddress
|
||||||
from collections.abc import Callable
|
from typing import Callable
|
||||||
|
|
||||||
# global constants
|
# global constants
|
||||||
XdbStructure20 = 2
|
XdbStructure20 = 2
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="py-ip2region",
|
name="py-ip2region",
|
||||||
version="3.0.1",
|
version="3.0.2",
|
||||||
description="ip2region official python binding with both IPv4 and IPv6 supported",
|
description="ip2region official python binding with both IPv4 and IPv6 supported",
|
||||||
long_description=open("ReadMe.md", encoding='utf-8').read(),
|
long_description=open("ReadMe.md", encoding='utf-8').read(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue