From 009c3e9242038d6880a80b65378e4b2051d12530 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 12 Nov 2022 11:26:37 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/geoip.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ATRI/plugins/geoip.py b/ATRI/plugins/geoip.py index a6521c2..fe09ab2 100644 --- a/ATRI/plugins/geoip.py +++ b/ATRI/plugins/geoip.py @@ -13,16 +13,13 @@ LANG = "zh-CN" @query_geoip.got("ip_address", prompt="地址是?(支持ipv4/ipv6)") async def _(ip_address: str = ArgStr()): - with geoip2.webservice.Client(conf.GeoIP.account_id, - conf.GeoIP.license_key, - host="geolite.info") as client: + with geoip2.webservice.Client( + conf.GeoIP.account_id, conf.GeoIP.license_key, host="geolite.info" + ) as client: response = client.city(ip_address) country = response.country.names[LANG] city = response.city.names[LANG] subdivision = "" if response.subdivisions: subdivision = response.subdivisions[0].names[LANG] - await query_geoip.finish( - f"IP: {ip_address}\n" - f"{country}{subdivision}{city}" - ) + await query_geoip.finish(f"IP: {ip_address}\n" f"{country}{subdivision}{city}") -- cgit v1.2.3