Skip to main content

termux_python

termux_python provides python bindings for https://wiki.termux.com/wiki/Termux:API and other termux scripts.

Install

This package is available via pip:

pip install termux-python

For development purposes, use poetry:

git clone https://github.com/mlvl42/termux_python
cd termux_python
poetry install

Example

The following example shows how some bindings could be used in a python script. Check the list of supported APIs as well as the content of the original termux-api scripts to understand how to use the bindings.

import termux
import textwrap

# retrieve various device infos
print(termux.wifi_connectioninfo())
print(termux.camera_info())
print(termux.telephony_deviceinfo())

# pretty print last 100 sms
messages = termux.sms_list(limit=100)

for m in messages:
    if 'sender' in m:
        print(f"{m['sender']}:")
    else:
        print(f"{m['number']}:")
    wrap = textwrap.TextWrapper(initial_indent='\t', subsequent_indent='\t')
    body = wrap.fill(m["body"])
    print(body)

# send a message
termux.sms_send("sending an sms from python", "+01020304050")

# perform an action if the fingerprint matches
ret = termux.fingerprint(title="Restricted action", desc="Analyze your fingerprint")
if ret['auth_result'] == 'AUTH_RESULT_SUCCESS':
    print("Access granted")
else:
    print("Access denied")

# text to speech
termux.tts_speak("job's done !")

Release files for termux-python 0.1.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 termux-python 0.1.0
File Size Uploaded
termux_python-0.1.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for termux-python 0.1.0
File Interpreter ABI Platform
termux_python-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / termux_python-0.1.0.tar.gz

Download URL termux_python-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bf291c3f47bc5cbcea9e7fea5cfa2d677d923a0ce16bee06893065e94891b1bf
BLAKE2b-256 checksum
How to use checksums
fa5e4f28842595baa680513984c7db0dc7e3d461518ba719899d825a3c3b0a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Linux/5.18.14-arch1-1

Release files / termux_python-0.1.0-py3-none-any.whl

Download URL termux_python-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d14e4f1cdb472b177b9f3b1a8692d4418d91753d32beff60c95071079a816fa
BLAKE2b-256 checksum
How to use checksums
07a5d5586374e6772c902c81b529f7bb7c640e59e87ad91a5de8afe634841445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Linux/5.18.14-arch1-1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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