How do I go about writing a program to send and receive sms using python?

前端 未结 6 1762
不思量自难忘°
不思量自难忘° 2021-02-10 00:38

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?

6条回答
  •  醉酒成梦
    2021-02-10 01:25

    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.

提交回复
热议问题