3.0.2 with python >= 3.7 supports

This commit is contained in:
lionsoul2014 2025-11-05 10:35:53 +08:00
parent 6eee95967b
commit aa5437c637
4 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,8 @@
# ip2region xdb python 查询客户端实现
# 版本兼容
该实现兼容 Python `>=` **`3.7`**
# 使用方式
### 安装 `py-ip2region`

View File

@ -7,6 +7,7 @@
import io
import ip2region.util as util
from typing import Union
class Searcher(object):
'''
@ -33,7 +34,7 @@ class Searcher(object):
def get_io_count(self):
return self.__io_count
def search(self, ip: bytes | str):
def search(self, ip: Union[bytes, str]):
# check and parse the string ip
ip_bytes = None
if isinstance(ip, str):

View File

@ -8,7 +8,7 @@
import io
import os
import ipaddress
from collections.abc import Callable
from typing import Callable
# global constants
XdbStructure20 = 2

View File

@ -2,7 +2,7 @@
setuptools.setup(
name="py-ip2region",
version="3.0.1",
version="3.0.2",
description="ip2region official python binding with both IPv4 and IPv6 supported",
long_description=open("ReadMe.md", encoding='utf-8').read(),
long_description_content_type='text/markdown',