Connect Python to your Mobile Phone to send 短信 或者 WhatsApp
Transform Your Phone into an SMS and WhatsApp Gateway with SMS Mobile API
Easily send and receive 短信 and send WhatsApp messages directly from your mobile phone using Python. Automate your communication effortlessly with a few simple lines of code!
Looking for a fast, secure, and simple way to send and receive 短信, or send WhatsApp messages using your mobile phone and Python? 短信移动API is the ultimate solution! It allows you to send 短信 instantly, retrieve incoming 短信, and send WhatsApp messages, turning your phone into a powerful communication tool for convenience, automation, and reliability.
要开始使用,只需使用以下命令安装模块:
pip 安装 smsmobileapi
在使用 Python 模块之前,请确保在 iOS 和 Android 上下载我们安全且经过验证的移动应用程序:
我们的应用程序经过 Google 和 Apple 的验证,确保稳定、安全的体验,尊重您的隐私。无论您是发送通知还是自动化消息传递工作流程, SMS Mobile API 是管理短信通信的完美解决方案 直接使用 Python 从你的手机中获取!
发送短信的请求示例
下面是使用 Python 代码发送短信的示例 短信移动应用接口 模块:
使用此代码, 短信将直接通过你的 Python 脚本通过手机发送,使用您的电话号码。
这意味着你的联系人可以直接回复你,并且 短信是免费的 因为它使用您的移动计划。
from smsmobileapi import SMSSender
# Initialize the SMS sender with your API key
sms = SMSSender(api_key='YOUR_API_KEY')
# Send an SMS
response = sms.send_message(to='PHONENUMBER', message='Hello from Python!')
print(response) # This will print the response from the API
Example Request to Send a WhatsApp Message
Here is an example of Python code to send a WhatsApp message using the 短信移动应用接口 模块:
With this code, a WhatsApp message will be sent directly from your Python script via your mobile phone, using your linked WhatsApp account.
This allows you to send messages effortlessly, and there are no per-message costs, as it uses your phone's WhatsApp connection.
from smsmobileapi import SMSSender
# Initialize the SMS sender with your API key
sms = SMSSender(api_key='YOUR_API_KEY')
# Send a WhatsApp message
response = sms.send_message(to='PHONENUMBER', message='Hello from Python via WhatsApp!', sendwa=1, sendsms=0)
print(response) # This will print the response from the API
Key Features
- WhatsApp Messages: Send messages directly via WhatsApp using your mobile connection.
- SMS Messages: Still need SMS? You can send both SMS and WhatsApp messages with ease.
- No Hidden Costs: Both SMS and WhatsApp messages are sent using your mobile plan—no per-message fees.
- Simple Integration: A few lines of Python code are all you need to get started.
检索收到的短信的示例请求
以下是检索手机上收到的短信的 Python 代码示例:
使用此脚本,您可以 检索手机上收到的所有短信 实时地,让您通过短信与联系人的回复进行互动。
from smsmobileapi import SMSSender
# Initialize the SMS sender with your API key
sms = SMSSender(api_key='YOUR_API_KEY')
# Retrieve received SMS messages
received_messages = sms.get_received_messages()
print(received_messages) # This will print the list of received SMSx