summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLint Action <[email protected]>2022-11-12 11:26:37 +0000
committerLint Action <[email protected]>2022-11-12 11:26:37 +0000
commit009c3e9242038d6880a80b65378e4b2051d12530 (patch)
treea1657fc76e4ede0a3b88426d1d55e56bb7eac417
parent751980112e14f0c86e3760c2595c46bf96fe5cfd (diff)
downloadATRI-009c3e9242038d6880a80b65378e4b2051d12530.tar.gz
ATRI-009c3e9242038d6880a80b65378e4b2051d12530.tar.bz2
ATRI-009c3e9242038d6880a80b65378e4b2051d12530.zip
:rotating_light: 自动进行代码格式化
-rw-r--r--ATRI/plugins/geoip.py11
1 files 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}")