Skip to main content

Control an attached GSM modem: send/receive SMS messages, handle calls, etc

Project description

python-gsmmodem-new

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 commandline 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 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 examples/ directory in this repo.

Requirements

  • Python 3.3 or later
  • pySerial

How to install this package

There are multiple ways to install python-gsmmodem-new package:

Automatic installation of the latest "stable" release from PyPI


    pip install python-gsmmodem-new

`pip <http://www.pip-installer.org>`_ will automatically download and install
all dependencies, as required. You can also utilise ``easy_install`` in the
same manner as using ``pip`` above.  

If you are utilising ``python-gsmmodem-new`` 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-new`` archive from `PyPI
<https://pypi.python.org/pypi/python-gsmmodem-new>`_, extract it and install the package with command::

    python setup.py install

Note that ``python-gsmmodem-new`` package relies on ``pySerial`` for serial communications: 
https://github.com/pyserial/pyserial

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-new`` package relies on ``pySerial`` for serial communications: 
https://github.com/pyserial/pyserial

Testing the package
-------------------

.. |Build Status| image::  https://travis-ci.org/babca/python-gsmmodem.svg?branch=master
.. _Build Status: https://travis-ci.org/babca/python-gsmmodem

.. |Coverage Status| image:: https://coveralls.io/repos/github/babca/python-gsmmodem/badge.svg?branch=master
.. _Coverage Status: https://coveralls.io/github/babca/python-gsmmodem?branch=master

|Build Status|_ |Coverage Status|_

To run all unit tests, do::

    python setup.py test

Unit test code coverage information may be generated by using `coverage
<https://pypi.python.org/pypi/coverage/>`_. You can execute it directly from
setup.py by doing::

    python setup.py coverage

This will run all unit tests and report on code coverage statistics.


Building documentation
----------------------

This package contains `Sphinx <http://sphinx-doc.org>`_-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 <http://www.virtualenv.org/>`_, 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 pluging 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_gsmmodem_weabox-1.0.4.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

python_gsmmodem_weabox-1.0.4-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file python_gsmmodem_weabox-1.0.4.tar.gz.

File metadata

  • Download URL: python_gsmmodem_weabox-1.0.4.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for python_gsmmodem_weabox-1.0.4.tar.gz
Algorithm Hash digest
SHA256 bc6a34ea9a0eaa7c633238102b4074f04d863910b03ff85b3df3a895465ee2c4
MD5 5b9020b7b8b7d7cdbec22f806a5f09c4
BLAKE2b-256 7da3ce8011677488809de1bcaa71886cc96c521cee76ba45b84ad24779f2e0a8

See more details on using hashes here.

File details

Details for the file python_gsmmodem_weabox-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for python_gsmmodem_weabox-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c5aa916723c7b97fa2cd7f4e2edad639ce4a3c57a8bece8358b85d63a67cf2fd
MD5 0b47379cf115efac3829d8be377cabb3
BLAKE2b-256 9499771a309154741ccd56390ab594cffc998e711c3fa8291017b42e7d4e0ac1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page