termux python bindings
Project description
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 !")
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
termux_python-0.1.0.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for termux_python-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d14e4f1cdb472b177b9f3b1a8692d4418d91753d32beff60c95071079a816fa |
|
MD5 | d9245169d4d4e4df23e6699e6ccfe512 |
|
BLAKE2b-256 | 07a5d5586374e6772c902c81b529f7bb7c640e59e87ad91a5de8afe634841445 |