Control an attached GSM modem: send/receive SMS messages, handle calls, etc
Project description
python-gsmmodem-weabox
GSM modem module for Python
python-gsmmodem
is a module that allows easy control of a GSM modem attached
to the system. It also includes a couple of useful command line utilities for
interacting with a GSM modem.
Its features include:
- Simple methods for sending SMS messages, checking signal level, etc.
- Easy-to-use API for starting and responding to USSD sessions and making voice calls.
- Handling incoming phone calls and received SMS messages via callback methods.
- Support for SMS PDU and text mode.
- Support for tracking SMS status reports.
- Wraps AT command errors into Python exceptions by default.
- Modular design; you can easily issue your own AT commands to the modem (with error checking), or read/write directly from/to the modem if you prefer.
- Comprehensive test suite.
Bundled utilities:
- GSMTerm: An easy-to-use serial terminal for communicating with an attached GSM modem. It features command completion, built-in help for many AT commands, history, context-aware prompt, etc.
- sendsms.py: A simple command line script to send SMS messages.
- identify-modem.py: Simple utility to identify attached modem. Can also be
used to provide debug information used for development of
python-gsmmodem
.
How to use this package
Go to the examples/
directory in this repository.
Requirements
- Python 3.3 or later
- pySerial
How to install this package
There are multiple ways to install python-gsmmodem-weabox
package:
Automatic installation of the latest "stable" release from PyPI
pip install python-gsmmodem-weabox
pip
will automatically download and install all dependencies, as required. You can also utilize easy_install
in the same manner as using pip
above.
If you are utilizing python-gsmmodem-weabox
as part of another project, add it to your install_requires
section of your setup.py
file and upon your project's installation, it will be pulled in automatically.
Manual installation of the latest "stable" release from PyPI
Download a python-gsmmodem-weabox
archive from PyPI, extract it, and install the package with the command:
python setup.py install
Note that python-gsmmodem-weabox
package relies on pySerial
for serial communications: pySerial GitHub
Installation of the latest commit from GitHub
Clone from GitHub:
git clone https://github.com/babca/python-gsmmodem.git
cd python-gsmmodem/
python setup.py install
Note that python-gsmmodem-weabox
package relies on pySerial
for serial communications: pySerial GitHub
Testing the package
To run all unit tests, use:
python setup.py test
Unit test code coverage information may be generated by using coverage
. You can execute it directly from setup.py by using:
python setup.py coverage
This will run all unit tests and report on code coverage statistics.
Building documentation
This package contains Sphinx
-based documentation. To manually build or test the documentation locally, do the following:
git clone https://github.com/babca/python-gsmmodem.git
cd python-gsmmodem
pip install .[doc]
cd doc
make html
For true isolation, you may wish to run the above commands within a virtualenv
, which will help you manage this development installation.
License information
Copyright (C) 2013 Francois Aucamp
See AUTHORS for all authors and contact information.
License: GNU Lesser General Public License, version 3 or later; see COPYING included in this archive for details.
FAQ
List all modem ports
You can simply list all ttyUSB devices before and after plugging the modem in.
ls /dev/ttyUSB*
Device or resource busy error
Check running processes. The device could be occupied by another program or another instance of gsmmodem
which is still running in the background. Run sudo lsof | grep tty
, try to locate the problematic process and sudo kill <PID>
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_gsmmodem_weabox-1.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f193a601b71195b05e1be99cc91965e1791ad00ec789cc770d7d17c7f294c38 |
|
MD5 | 034f9154284d8f6576e08d183e991749 |
|
BLAKE2b-256 | 0d36b3d87e91ca98e774eed1dfa4538a2a54369bf1af98355a6457502e172f48 |
Hashes for python_gsmmodem_weabox-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bde9a0b08ab8c8de32b6e8179b72a1053e23af1d41e696b3183a46ed77a8e3a |
|
MD5 | 7e63314ff381d551de500cec742fad69 |
|
BLAKE2b-256 | 9e0a51915c8db78f4f769a9e5025f6efb7d50338e33406c1249cfd59b9b1d1e7 |