# handles spaces, accents and other sneaky characters in ADB commands
## Tested against Windows / Python 3.11 / Anaconda
## pip install adbeasykey
```python
from adbeasykey import AdbEasyKey
adbpath = r"C:\Android\android-sdk\platform-tools\adb.exe"
serial_number = "127.0.0.1:5555"
adb = AdbEasyKey(adbpath, serial_number, use_busybox=False) # if use_busybox is True, busybox will be used to decode the base64-encoded command
adb.connect_to_device_ps()
adb.connect_to_device_subprocess()
text = f'"it\'s me", he said then he went away "Montréal, über, 12.89, Mère, Françoise, noël, 889 groß"""'
adb.install_adb_keyboard()
adb.input_text_adb_keyboard_ps(
text, change_back=True, sleeptime=(0, 0), add_exit=True
) # preserves accents - suffix _ps is for use Windows Powershell
adb.input_text_adb_keyboard_subprocess(
text, change_back=True, sleeptime=(0.1, 0.2), add_exit=True
) # preserves accents
adb.keyevents.KEYCODE_A.press_ps()
adb.keyevents.KEYCODE_A.press_subproc()
adb.keyevents.KEYCODE_A.longpress_subproc()
adb.keyevents.KEYCODE_A.longpress_ps()
adb.input_text_ps(text) # doesn't preserve accents
adb.input_text_ps(text, remove_accents=True) # ç -> c
adb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True) # one by one
adb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True, input_device='keyboard')
adb.keyevents.KEYCODE_A.longpress_ps.gamepad()
adb.keyevents.KEYCODE_A.longpress_ps.keyboard()
adb.input_text_subprocess(text) # doesn't preserve accents
adb.input_text_subprocess(text, remove_accents=True) # ç -> c
adb.input_text_subprocess(text, sleeptime=(0.1, 0.2), remove_accents=True)
stdout, stderr = adb.adb_shell_ps("ls / -1 -R -i -H -las")
stdout, stderr = adb.adb_shell_ps("ls /data") # no permission
stdout, stderr = adb.adb_shell_ps("ls /data", su=True) # permission
stdout, stderr = adb.adb_shell_ps('mkdir "/sdcard/bub ö äß"')
stdout, stderr = adb.adb_shell_ps("ls /sdcard/")
stdout, stderr = adb.adb_shell_subprocess("ls / -1 -R -i -H -las")
stdout, stderr = adb.adb_shell_subprocess("ls /data") # no permission
stdout, stderr = adb.adb_shell_subprocess("ls /data", su=True) # permission
stdout, stderr = adb.adb_shell_subprocess('mkdir "/sdcard/#gx bub ö äß"')
stdout, stderr = adb.adb_shell_subprocess("ls /sdcard/")
stdout, stderr = adb.adb_ps(
cmd=r"push C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf"
)
stdout, stderr = adb.adb_subprocess(
cmd=r"push C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf"
)
stdout, stderr = adb.adb_shell_ps(
"input swipe 600 600 0 0 1000\ninput swipe 0 0 600 600 1000",
)
adb.is_keyboard_shown()
adb.get_active_keyboard()
adb.change_to_adb_keyboard()
adb.change_keyboard(
keyboard="com.android.inputmethod.latin/.LatinIME",
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/adbeasykey",
"name": "adbeasykey",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adb,android,keyevent,input text",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/54/bf/6f3e92c78e38df7298ee0c418787aedf317303e3bf7d705d165aa42c10d9/adbeasykey-0.12.tar.gz",
"platform": null,
"description": "\r\n# handles spaces, accents and other sneaky characters in ADB commands \r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n## pip install adbeasykey\r\n\r\n```python\r\n\r\nfrom adbeasykey import AdbEasyKey\r\nadbpath = r\"C:\\Android\\android-sdk\\platform-tools\\adb.exe\"\r\nserial_number = \"127.0.0.1:5555\"\r\nadb = AdbEasyKey(adbpath, serial_number, use_busybox=False) # if use_busybox is True, busybox will be used to decode the base64-encoded command\r\nadb.connect_to_device_ps()\r\nadb.connect_to_device_subprocess()\r\ntext = f'\"it\\'s me\", he said then he went away \"Montr\u00e9al, \u00fcber, 12.89, M\u00e8re, Fran\u00e7oise, no\u00ebl, 889 gro\u00df\"\"\"'\r\nadb.install_adb_keyboard()\r\nadb.input_text_adb_keyboard_ps(\r\n text, change_back=True, sleeptime=(0, 0), add_exit=True\r\n) # preserves accents - suffix _ps is for use Windows Powershell\r\nadb.input_text_adb_keyboard_subprocess(\r\n text, change_back=True, sleeptime=(0.1, 0.2), add_exit=True\r\n) # preserves accents\r\nadb.keyevents.KEYCODE_A.press_ps()\r\nadb.keyevents.KEYCODE_A.press_subproc()\r\nadb.keyevents.KEYCODE_A.longpress_subproc()\r\nadb.keyevents.KEYCODE_A.longpress_ps()\r\nadb.input_text_ps(text) # doesn't preserve accents\r\nadb.input_text_ps(text, remove_accents=True) # \u00e7 -> c\r\nadb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True) # one by one\r\nadb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True, input_device='keyboard') \r\nadb.keyevents.KEYCODE_A.longpress_ps.gamepad()\r\nadb.keyevents.KEYCODE_A.longpress_ps.keyboard()\r\nadb.input_text_subprocess(text) # doesn't preserve accents\r\nadb.input_text_subprocess(text, remove_accents=True) # \u00e7 -> c\r\nadb.input_text_subprocess(text, sleeptime=(0.1, 0.2), remove_accents=True)\r\nstdout, stderr = adb.adb_shell_ps(\"ls / -1 -R -i -H -las\")\r\nstdout, stderr = adb.adb_shell_ps(\"ls /data\") # no permission\r\nstdout, stderr = adb.adb_shell_ps(\"ls /data\", su=True) # permission\r\nstdout, stderr = adb.adb_shell_ps('mkdir \"/sdcard/bub \u00f6 \u00e4\u00df\"')\r\nstdout, stderr = adb.adb_shell_ps(\"ls /sdcard/\")\r\nstdout, stderr = adb.adb_shell_subprocess(\"ls / -1 -R -i -H -las\")\r\nstdout, stderr = adb.adb_shell_subprocess(\"ls /data\") # no permission\r\nstdout, stderr = adb.adb_shell_subprocess(\"ls /data\", su=True) # permission\r\nstdout, stderr = adb.adb_shell_subprocess('mkdir \"/sdcard/#gx bub \u00f6 \u00e4\u00df\"')\r\nstdout, stderr = adb.adb_shell_subprocess(\"ls /sdcard/\")\r\nstdout, stderr = adb.adb_ps(\r\n cmd=r\"push C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf\"\r\n)\r\nstdout, stderr = adb.adb_subprocess(\r\n cmd=r\"push C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf\"\r\n)\r\n\r\nstdout, stderr = adb.adb_shell_ps(\r\n \"input swipe 600 600 0 0 1000\\ninput swipe 0 0 600 600 1000\",\r\n)\r\nadb.is_keyboard_shown()\r\nadb.get_active_keyboard()\r\nadb.change_to_adb_keyboard()\r\nadb.change_keyboard(\r\n keyboard=\"com.android.inputmethod.latin/.LatinIME\",\r\n)\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "handles spaces, accents and other sneaky characters in ADB commands",
"version": "0.12",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/adbeasykey"
},
"split_keywords": [
"adb",
"android",
"keyevent",
"input text"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c14d7f2715d7db77e51c6ff6ae562f22401397fafdffc161782f9a9c4b3f82b9",
"md5": "eecdc671903cf14e8d8bab8ddf309a20",
"sha256": "02cd86e82b0e89f6fbbe566dfeccc0f30f90599258c4d80420e6adfc7afd77c1"
},
"downloads": -1,
"filename": "adbeasykey-0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eecdc671903cf14e8d8bab8ddf309a20",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 27044,
"upload_time": "2023-10-12T02:27:32",
"upload_time_iso_8601": "2023-10-12T02:27:32.119795Z",
"url": "https://files.pythonhosted.org/packages/c1/4d/7f2715d7db77e51c6ff6ae562f22401397fafdffc161782f9a9c4b3f82b9/adbeasykey-0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "54bf6f3e92c78e38df7298ee0c418787aedf317303e3bf7d705d165aa42c10d9",
"md5": "c7199ecd788efb5b48c4942351b614c6",
"sha256": "520011ca77cb8e0d3f1f074b1497d69a1aef8056d85085b7daa8d9ab7acf7dff"
},
"downloads": -1,
"filename": "adbeasykey-0.12.tar.gz",
"has_sig": false,
"md5_digest": "c7199ecd788efb5b48c4942351b614c6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26604,
"upload_time": "2023-10-12T02:27:34",
"upload_time_iso_8601": "2023-10-12T02:27:34.024032Z",
"url": "https://files.pythonhosted.org/packages/54/bf/6f3e92c78e38df7298ee0c418787aedf317303e3bf7d705d165aa42c10d9/adbeasykey-0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-12 02:27:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "adbeasykey",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "adbeasykey"
}