- 授权协议: LGPL
- 开发语言: Python
- 操作系统: 跨平台
- 软件首页: https://github.com/faucamp/python-gsmmodem
- 软件文档: https://github.com/faucamp/python-gsmmodem
- 官方下载: https://github.com/faucamp/python-gsmmodem
软件介绍
Python实现的短信发送/接收库,支持多种型号的短信猫。主要功能有:
发送短信、检测信号强度
基于回调的来电和短信处理方法
支持短信状态报告追踪
使用Python异常包裹AT命令错误
模块化代码,具有良好的扩展能力
提供了一些简单的调试工具。
示例
短信接收和回复
#!/usr/bin/env python
"""\
Demo: handle incoming SMS messages by replying to them
Simple demo app that listens for incoming SMS messages, displays the sender's number
and the messages, then replies to the SMS by saying "thank you"
"""
from __future__ import print_function
import logging
PORT = '/dev/ttyUSB2'
BAUDRATE = 115200
PIN = None # SIM card PIN (if any)
from gsmmodem.modem import GsmModem
def handleSms(sms):
print(u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text))
print('Replying to SMS...')
sms.reply(u'SMS received: "{0}{1}"'.format(sms.text[:20], '...' if len(sms.text) > 20 else ''))
print('SMS sent.\n')
def main():
print('Initializing modem...')
# Uncomment the following line to see what the modem is doing:
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
modem = GsmModem(PORT, BAUDRATE, smsReceivedCallbackFunc=handleSms)
modem.smsTextMode = False
modem.connect(PIN)
print('Waiting for SMS message...')
try:
modem.rxThread.join(2**31) # Specify a (huge) timeout so that it essentially blocks indefinitely, but still receives CTRL+C interrupt signal
finally:
modem.close();
if __name__ == '__main__':
main()
决战618:探秘京东技术取胜之道
京东集团618作战指挥中心 / 电子工业出版社 / 2017-11 / 99
《决战618:探秘京东技术取胜之道》以京东技术团队备战618为主线,集合京东数百位技术专家,对京东所有和618相关的关键技术系统进行了一次全面的梳理和总结,是京东技术体系的智慧结晶。 《决战618:探秘京东技术取胜之道》从前端的网站、移动入口到后端的结算、履约、物流、供应链等体系,系统展示了京东最新的技术成就。同时,也涵盖了京东正在充分运用大数据、人工智能等先进技术对所有技术体系架构进行整体......一起来看看 《决战618:探秘京东技术取胜之道》 这本书的介绍吧!
