Skip to main content

银狼接码官方 Python SDK - 短信验证码接收平台开放 API(长效号码 / 在线接码)

Project description

yinglangsms — 银狼接码官方 Python SDK

银狼接码 开放 API 的 Python 封装:程序化购买海外手机号码、接收短信验证码。Python 3.8+,仅依赖 requests。

安装

pip install yinglangsms
# 或直接把 yinglangsms/ 目录复制进你的项目

快速开始

from yinglangsms import YinglangSMS, YinglangSMSError

client = YinglangSMS("你的API_KEY")

me = client.get_user_info()
print(me["username"], me["balance"])

在线接码(取号 → 等验证码 → 未收到自动释放退款)

result = client.online_buy(app_id="1001", country="52", quantity=1)
session = result["list"][0]
print("号码:", session["tel"])

try:
    done = client.online_wait_code(session["session_no"], timeout=300, interval=5)
    print("验证码:", done["code"], "短信:", done["sms_content"])
except TimeoutError:
    client.online_release(session["session_no"])
    print("未收到验证码,已释放退款")

长效号码(批量购买 → 轮询短信)

result = client.create_order(app_id=123, num=10, prefix="1440")
print("订单:", result["order"]["order_id"], "号码数:", len(result["phones"]))

sms = client.wait_for_sms(result["phones"][0]["token"], timeout=300)
print("收到短信:", sms)

错误处理

try:
    client.create_order(app_id=123, num=1)
except YinglangSMSError as e:
    print("业务失败:", e, "code:", e.code, "http:", e.http_status)

全部方法

方法 说明
get_user_info() 余额查询
get_categories() 项目分类
get_apps(page, limit, keyword, cate_id) 项目列表
get_prefixes(app_id, type, expiry) 号码前缀
create_order(app_id, num, expiry, prefix, exclude_prefix) 购买号码
list_orders(page, limit, order_id, app_name) 订单列表
list_phones(page, limit, order_id, app_name, tel) 号码列表
get_sms(token) 查询短信(未收到返回 None
wait_for_sms(token, timeout, interval) 轮询等短信
online_apps(keyword) 在线接码应用列表
online_countries(app_id, keyword) 国家报价
online_buy(app_id, country, quantity) 购买取号
online_get_code(session_no) 查询会话/取码
online_wait_code(session_no, timeout, interval) 轮询等验证码
online_release(session_no) 释放退款
online_orders(page, limit, status, tel) 接码记录

链接

MIT License · © 银狼接码

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yinglangsms-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yinglangsms-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file yinglangsms-1.0.0.tar.gz.

File metadata

  • Download URL: yinglangsms-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for yinglangsms-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1bddede324af7959a38316fe86d0f984b3c708eb54e5abdb2e6f64cfa354aebb
MD5 590efabe6cb68d1f5a510fca2e09851d
BLAKE2b-256 517fb6b85d0f08afab74477c163cafe54233cde63db4fbb9fdfb63e364035107

See more details on using hashes here.

File details

Details for the file yinglangsms-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: yinglangsms-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for yinglangsms-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6613a1fde58568fe98c4197f21cbcf19bc4114149e3bfb785233079fc88fe00
MD5 140c48be98a7754730749dbbb2e75c7f
BLAKE2b-256 50c4e51822c548c5ff46568e2a4ebfa97b2fb17ce2826be65619022855ce3839

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page