如何使用 python 编写一个程序来发送和接收短信?

发布于 2024-07-15 13:08:43 字数 73 浏览 5 评论 0原文

我在网上寻找一个好的库来使用 python 发送和接收短信,但一切都是徒劳的!

那里有Python的GSM库吗?

I have looked all over the net for a good library to use in sending and receiving sms's using python but all in vain!

Are there GSM libraries for python out there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

睫毛上残留的泪 2024-07-22 13:08:44

您看过 py-sms 吗?

Have you looked at py-sms?

何以笙箫默 2024-07-22 13:08:44

Python 绑定 for Gammu 也许?

顺便提一句。 它的 GUI 版本 (Wammu) 是用 wxPython 编写的。

Python-binding for Gammu perhaps?

BTW. It's GUI version (Wammu) is written in wxPython.

月寒剑心 2024-07-22 13:08:44

我最近用Python编写了一些与华为3G USB调制解调器交互的代码。

我的初始原型直接使用 pyserial,然后我的生产代码使用 Twisted 的串行支持,这样我就可以异步访问调制解调器。

我发现通过使用串行端口以编程方式访问调制解调器,我能够访问使用 Hayes AT 命令和 AT 命令集扩展发送和接收 SMS 消息所需的所有功能。

这是我能够找到的有关该主题的参考资料之一,它列出了这些命令:

AT+CMGL      List Messages
AT+CMGR     Read message
AT+CMGS     Send message
AT+CMGW     Write message to memory 

它们是复杂的命令并带有参数,您必须自己解析结果。

互联网上有更多参考资料,您可以在 google 上搜索,参考这 4 个命令让您了解调制解调器的工作原理。

I have recently written some code for interacting with Huawei 3G USB modems in python.

My initial prototype used pyserial directly, and then my production code used Twisted's Serial support so I can access the modem asynchronously.

I found that by accessing the modem programatically using the serial port I was able to access all the functionality required to send and receive SMS messages using Hayes AT commands and extensions to the AT command set.

This is the one of the referneces I was able to find on the topic, it lists these commands:

AT+CMGL      List Messages
AT+CMGR     Read message
AT+CMGS     Send message
AT+CMGW     Write message to memory 

They are complicated commands and take arguments and you have to parse the results yourself.

There are more references on the internet you can google for that reference these 4 commands that will let you work out how your modem works.

并安 2024-07-22 13:08:44

我提供了类似问题的详细答案 这里。 我提到了 TextMagic 提供的 SMS 网关的 Python 接口。

I provided a detailed answer to a similar question here. I mention a Python interface to an SMS gateway provided by TextMagic.

小清晰的声音 2024-07-22 13:08:44

另请检查 PyKannel

还有一个用于发送和接收 SMS 的 Web 服务(当然不是免费的),但我手头没有 URL。 :(

Also check PyKannel.

There's also a web service for sending and receiving SMS (non-free, of course), but I don't have URL at hand. :(

淡莣 2024-07-22 13:08:44

我参加了一个黑客日,我们可以免费访问一些 API,包括 twillio。 使用他们的 python 库发送和接收短信非常容易,我们在大约 3 小时内围绕它构建了一个应用程序(twillio 集成大约需要 15 分钟)。

I was at a hackday where we had free access to a few APIs, including twillio. It was very easy to use their python library to send and receive SMS, and we built an app around it in about 3 hours (twillio integration was about 15 minutes).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文