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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file termux_python-0.1.0.tar.gz.
File metadata
- Download URL: termux_python-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.5 Linux/5.18.14-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf291c3f47bc5cbcea9e7fea5cfa2d677d923a0ce16bee06893065e94891b1bf
|
|
| MD5 |
463c091ad26889c80f8236929f296b21
|
|
| BLAKE2b-256 |
fa5e4f28842595baa680513984c7db0dc7e3d461518ba719899d825a3c3b0a18
|
File details
Details for the file termux_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: termux_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.5 Linux/5.18.14-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d14e4f1cdb472b177b9f3b1a8692d4418d91753d32beff60c95071079a816fa
|
|
| MD5 |
d9245169d4d4e4df23e6699e6ccfe512
|
|
| BLAKE2b-256 |
07a5d5586374e6772c902c81b529f7bb7c640e59e87ad91a5de8afe634841445
|