Skip to main content

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 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, 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 Coverage Status

To run all unit tests, do:

python setup.py test

Unit test code coverage information may be generated by using 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-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 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>.

Metadata

Release files for python-gsmmodem-new 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-gsmmodem-new 0.13.0
File Size Uploaded Provenance Actions
python-gsmmodem-new-0.13.0.tar.gz 118.6 kB Without provenance Details for python-gsmmodem-new-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-gsmmodem-new 0.13.0
File Interpreter ABI Platform Actions
python_gsmmodem_new-0.13.0-py3-none-any.whl Python 3 none any Details for python_gsmmodem_new-0.13.0-py3-none-any.whl

Total release size: 188.8 kB

Release files / python-gsmmodem-new-0.13.0.tar.gz

Download URL python-gsmmodem-new-0.13.0.tar.gz
Size 118.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a991b3f1b2a78b2c2ebf70c46ec399c241dbaafeb84c22e5583dfcb92238194b
BLAKE2b-256 checksum
How to use checksums
de10f22815db197cc85c05e815091cc56aa6886c6775a207b35e4298a6a4370b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / python_gsmmodem_new-0.13.0-py3-none-any.whl

Download URL python_gsmmodem_new-0.13.0-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
369d33c2763fd0046f671a827e7d28c5955a82a48bc8abf408b7c65b68774c45
BLAKE2b-256 checksum
How to use checksums
47ccc04ee73f8b226326fbb62ef70fb4f45c5f8759f521023ea54b593df1098a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for python-gsmmodem-new 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files No provenance

0.10

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page