
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
一个简单易用的TQ短信验证码API Python客户端库。
pip install tq-sms
from tq_sms import TQSmsClient
# 使用用户名和密码初始化(会自动登录)
client = TQSmsClient(username="您的用户名", password="您的密码")
# 或者使用已有的token
# client = TQSmsClient(token="您的token")
# 获取余额
balance = client.get_wallet()
print(f"余额: {balance['data']['balances']}")
# 获取手机号
phone_result = client.get_phone(channel_id="您的渠道ID")
phone_number = phone_result['data']['mobile']
print(f"获取到手机号: {phone_number}")
# 获取验证码
code_result = client.get_code(channel_id="您的渠道ID", phone_num=phone_number)
if code_result['data']['code']:
print(f"验证码: {code_result['data']['code']}")
# 如果没获取到验证码,拉黑手机号
else:
client.blacklist_phone(channel_id="您的渠道ID", phone_no=phone_number)
print("已拉黑手机号")
# 获取验证码(带重试机制)
code = client.get_code_with_retry(
channel_id="您的渠道ID",
phone_num=phone_number,
max_retries=50
)
if code:
print(f"验证码: {code}")
else:
print("获取验证码失败")
# 拉黑手机号
client.blacklist_phone(channel_id="您的渠道ID", phone_no=phone_number)
login()
登录获取token(如果初始化时提供了用户名密码会自动调用)
get_wallet()
获取用户余额
get_phone(channel_id, phone_num=None, operator=None, scope=None)
获取手机号
channel_id
: 渠道ID(必需)phone_num
: 指定手机号码(可选)operator
: 运营商类型,0=全部,5=虚拟,4=非虚拟(可选)scope
: 指定号段,多个号段用逗号隔开(可选)get_code(channel_id, phone_num)
获取验证码
channel_id
: 渠道ID(必需)phone_num
: 手机号码(必需)blacklist_phone(channel_id, phone_no)
拉黑手机号码
channel_id
: 渠道ID(必需)phone_no
: 手机号码(必需)get_code_with_retry(channel_id, phone_num, max_retries=100)
获取验证码(带重试机制)
channel_id
: 渠道ID(必需)phone_num
: 手机号码(必需)max_retries
: 最大重试次数,默认100次(可选)所有方法在失败时会抛出异常:
ValueError
: 参数错误Exception
: API调用失败MIT License
欢迎提交Issue和Pull Request。
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.