mirror of
https://github.com/miaowware/qrm2.git
synced 2025-04-11 05:58:31 -04:00
Use str.isalnum and str.isdecimal instead of re.match for ?ae7q and ?qrz input validation
This commit is contained in:
parent
4ab4748b9f
commit
483a0bad19
12
exts/ae7q.py
12
exts/ae7q.py
@ -16,8 +16,6 @@ the GNU General Public License, version 2.
|
||||
# KC4USA: reserved, no call history, *but* has application history
|
||||
|
||||
|
||||
import re
|
||||
|
||||
import aiohttp
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
@ -46,7 +44,7 @@ class AE7QCog(commands.Cog):
|
||||
base_url = "http://ae7q.com/query/data/CallHistory.php?CALL="
|
||||
embed = cmn.embed_factory(ctx)
|
||||
|
||||
if not re.match('[A-Z0-9]+$', callsign):
|
||||
if not callsign.isalnum():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "AE7Q History for Callsign"
|
||||
embed.colour = cmn.colours.bad
|
||||
@ -120,7 +118,7 @@ class AE7QCog(commands.Cog):
|
||||
base_url = "http://ae7q.com/query/data/CallHistory.php?CALL="
|
||||
embed = cmn.embed_factory(ctx)
|
||||
|
||||
if not re.match('[A-Z0-9]+$', callsign):
|
||||
if not callsign.isalnum():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "AE7Q Trustee History for Callsign"
|
||||
embed.colour = cmn.colours.bad
|
||||
@ -196,7 +194,7 @@ class AE7QCog(commands.Cog):
|
||||
base_url = "http://ae7q.com/query/data/CallHistory.php?CALL="
|
||||
embed = cmn.embed_factory(ctx)
|
||||
|
||||
if not re.match('[A-Z0-9]+$', callsign):
|
||||
if not callsign.isalnum():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "AE7Q Application History for Callsign"
|
||||
embed.colour = cmn.colours.bad
|
||||
@ -276,7 +274,7 @@ class AE7QCog(commands.Cog):
|
||||
base_url = "http://ae7q.com/query/data/FrnHistory.php?FRN="
|
||||
embed = cmn.embed_factory(ctx)
|
||||
|
||||
if not re.match('[0-9]+$', frn):
|
||||
if not frn.isdecimal():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "AE7Q History for FRN"
|
||||
embed.colour = cmn.colours.bad
|
||||
@ -347,7 +345,7 @@ class AE7QCog(commands.Cog):
|
||||
base_url = "http://ae7q.com/query/data/LicenseeIdHistory.php?ID="
|
||||
embed = cmn.embed_factory(ctx)
|
||||
|
||||
if not re.match('[A-Z][0-9]+$', licensee_id, re.IGNORECASE):
|
||||
if not licensee_id.isalnum():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "AE7Q History for Licensee"
|
||||
embed.colour = cmn.colours.bad
|
||||
|
@ -9,7 +9,6 @@ the GNU General Public License, version 2.
|
||||
|
||||
|
||||
from io import BytesIO
|
||||
import re
|
||||
|
||||
import aiohttp
|
||||
from lxml import etree
|
||||
@ -32,7 +31,7 @@ class QRZCog(commands.Cog):
|
||||
"""Looks up a callsign on [QRZ.com](https://www.qrz.com/). Add `--link` to only link the QRZ page."""
|
||||
flags = [f.lower() for f in flags]
|
||||
|
||||
if not re.match('[A-Z0-9]+$', callsign, re.IGNORECASE):
|
||||
if not callsign.isalnum():
|
||||
embed = cmn.embed_factory(ctx)
|
||||
embed.title = "QRZ Data for Callsign"
|
||||
embed.colour = cmn.colours.bad
|
||||
|
Loading…
Reference in New Issue
Block a user