{ "info": { "author": "Swind Ou", "author_email": "swind@cloudmosa.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Testing" ], "description": "This is pure-python implementation of the ADB client.\n\nYou can use it to communicate with adb server (not the adb daemon on the device/emulator).\n\nWhen you use `adb` command\n\n.. image:: https://raw.githubusercontent.com/Swind/pure-python-adb/master/docs/adb_cli.png\n\nNow you can use `pure-python-adb` to connect to adb server as adb command line\n\n.. image:: https://raw.githubusercontent.com/Swind/pure-python-adb/master/docs/adb_pure_python_adb.png\n\nThis package supports most of the adb command line tool's functionality.\n\n1. adb devices\n2. adb shell\n3. adb forward\n4. adb pull/push\n5. adb install/uninstall\n\nRequirements\n============\n\nPython 2.7+ / Python 3.6+\n\nInstallation\n============\n\n.. code-block:: console\n\n $pip install -U pure-python-adb-homeassistant\n\nExamples\n========\n\nConnect to adb server and get the version\n-----------------------------------------\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n print(client.version())\n\n >>> 39\n\nConnect to a device\n-------------------\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n\nList all devices ( adb devices ) and install/uninstall an APK on all devices\n----------------------------------------------------------------------------\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n\n apk_path = \"example.apk\"\n\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n devices = client.devices()\n\n for device in devices:\n device.install(apk_path)\n\n # Check apk is installed\n for device in devices:\n print(device.is_installed(\"example.package\"))\n\n # Uninstall\n for device in devices:\n device.uninstall(\"example.package)\n\nadb shell\n---------\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n device.shell(\"echo hello world !\")\n\n.. code-block:: python\n\n def dump_logcat(connection):\n while True:\n data = connection.read(1024)\n if not data:\n break\n print(data.decode('utf-8'))\n\n connection.close()\n\n from adb_messenger.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n device.shell(\"logcat\", handler=dump_logcat)\n\nread logcat line by line\n\n.. code-block:: python\n\n from adb_messenger.client import Client\n\n def dump_logcat_by_line(connect):\n file_obj = connect.socket.makefile()\n for index in range(0, 10):\n print(\"Line {}: {}\".format(index, file_obj.readline().strip()))\n\n file_obj.close()\n connect.close()\n\n client = Client()\n device = client.device(\"emulator-5554\")\n device.shell(\"logcat\", handler=dump_logcat_by_line)\n\nScreenshot\n----------\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n result = device.screencap()\n with open(\"screen.png\", \"wb\") as fp:\n fp.write(result)\n\nPush\n----\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n device.push(\"example.apk\", \"/sdcard/example.apk\")\n\nPull\n----\n\n.. code-block:: python\n\n from adb_messenger.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n device.shell(\"screencap -p /sdcard/screen.png\")\n device.pull(\"/sdcard/screen.png\", \"screen.png\")\n\nHow to run test cases\n======================\n\nPrepare\n--------\n\n1. Install Docker\n\n2. Install Docker Compose\n\n.. code-block:: console\n\n pip install docker-compose\n\n3. Modify `test/conftest.py`\n\nChange the value of `adb_host` to the \"emulator\"\n\n.. code-block:: python\n\n adb_host=\"emulator\"\n\n4. Run testcases\n\n.. code-block:: console\n\n docker-compose up\n\nResult\n\n.. code-block:: console\n\n Starting purepythonadb_emulator_1 ... done\n Recreating purepythonadb_python_environment_1 ... done\n Attaching to purepythonadb_emulator_1, purepythonadb_python_environment_1\n emulator_1 | + echo n\n emulator_1 | + /home/user/android-sdk-linux/tools/bin/avdmanager create avd -k system-images;android-25;google_apis;x86 -n Docker -b x86 -g google_apis --device 8 --force\n Parsing /home/user/android-sdk-linux/emulator/package.xmlParsing /home/user/android-sdk-linux/patcher/v4/package.xmlParsing /home/user/android-sdk-linux/platform-tools/package.xmlParsing /home/user/android-sdk-linux/platforms/android-25/package.xmlParsing /home/user/android-sdk-linux/system-images/android-25/google_apis/x86/package.xmlParsing /home/user/android-sdk-linux/tools/package.xml+ echo hw.keyboard = true\n emulator_1 | + adb start-server\n emulator_1 | * daemon not running; starting now at tcp:5037\n python_environment_1 | ============================= test session starts ==============================\n python_environment_1 | platform linux -- Python 3.6.1, pytest-3.6.3, py-1.5.4, pluggy-0.6.0\n python_environment_1 | rootdir: /code, inifile:\n python_environment_1 | collected 27 items\n python_environment_1 |\n emulator_1 | * daemon started successfully\n emulator_1 | + exec /usr/bin/supervisord\n emulator_1 | /usr/lib/python2.7/dist-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a \"-c\" argument specifying an absolute path to a configuration file for improved security.\n emulator_1 | 'Supervisord is running as root and it is searching '\n emulator_1 | 2018-07-07 17:19:47,560 CRIT Supervisor running as root (no user in config file)\n emulator_1 | 2018-07-07 17:19:47,560 INFO Included extra file \"/etc/supervisor/conf.d/supervisord.conf\" during parsing\n emulator_1 | 2018-07-07 17:19:47,570 INFO RPC interface 'supervisor' initialized\n emulator_1 | 2018-07-07 17:19:47,570 CRIT Server 'unix_http_server' running without any HTTP authentication checking\n emulator_1 | 2018-07-07 17:19:47,570 INFO supervisord started with pid 1\n emulator_1 | 2018-07-07 17:19:48,573 INFO spawned: 'socat-5554' with pid 74\n emulator_1 | 2018-07-07 17:19:48,574 INFO spawned: 'socat-5555' with pid 75\n emulator_1 | 2018-07-07 17:19:48,576 INFO spawned: 'socat-5037' with pid 76\n emulator_1 | 2018-07-07 17:19:48,578 INFO spawned: 'novnc' with pid 77\n emulator_1 | 2018-07-07 17:19:48,579 INFO spawned: 'socat-9008' with pid 78\n emulator_1 | 2018-07-07 17:19:48,582 INFO spawned: 'emulator' with pid 80\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5554 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5555 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5037 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,608 INFO success: socat-9008 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,608 INFO success: emulator entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n python_environment_1 | test/test_device.py .............. [ 51%]\n python_environment_1 | test/test_host.py .. [ 59%]\n python_environment_1 | test/test_host_serial.py ........ [ 88%]\n python_environment_1 | test/test_plugins.py ... [100%]\n python_environment_1 |\n python_environment_1 | ------------------ generated xml file: /code/test_result.xml -------------------\n python_environment_1 | ========================= 27 passed in 119.15 seconds ==========================\n purepythonadb_python_environment_1 exited with code 0\n Aborting on container exit...\n Stopping purepythonadb_emulator_1 ... done\n\nMore Information\n=================\n\nA pure Node.js client for the Android Debug Bridge\n---------------------------------------------------\n\nadbkit_\n\nADB documents\n--------------\n\n- protocol_\n- services_\n- sync_\n\n.. _adbkit: https://github.com/openstf/stf\n.. _protocol: https://android.googlesource.com/platform/system/core/+/master/adb/protocol.txt\n.. _services: https://android.googlesource.com/platform/system/core/+/master/adb/SERVICES.TXT\n.. _sync: https://android.googlesource.com/platform/system/core/+/master/adb/SYNC.TXT\n\n\n0.1.0 (2018-06-23)\n------------------\n\n* First release on PyPI.\n\n0.1.6 (2019-01-21)\n------------------\n\n* Fix #4 push does not preserve original timestap unlike equiv adb push from command line\n* Fix #6 forward_list should also check serial\n* Fix #8: adb/command/host/__init__.py can take an exception parsing \"devices\" data\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Swind/pure-python-adb", "keywords": "adb", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "pure-python-adb-homeassistant", "package_url": "https://pypi.org/project/pure-python-adb-homeassistant/", "platform": "", "project_url": "https://pypi.org/project/pure-python-adb-homeassistant/", "project_urls": { "Homepage": "https://github.com/Swind/pure-python-adb" }, "release_url": "https://pypi.org/project/pure-python-adb-homeassistant/0.1.7.dev0/", "requires_dist": null, "requires_python": "", "summary": "Pure python implementation of the adb client", "version": "0.1.7.dev0" }, "last_serial": 5460275, "releases": { "0.1.5.dev0": [ { "comment_text": "", "digests": { "md5": "43a69c9fe88ffbe66375c493014b6365", "sha256": "870393e5c7edf23ac6efb50802435f3db9256f48b2215bf5f654c8450aeaca5c" }, "downloads": -1, "filename": "pure_python_adb_homeassistant-0.1.5.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "43a69c9fe88ffbe66375c493014b6365", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20529, "upload_time": "2018-12-08T17:45:34", "url": "https://files.pythonhosted.org/packages/98/a2/8fab0016a5e7939103a1cafcb5f5592e0e1b918c97fc863f5c67329f8b3f/pure_python_adb_homeassistant-0.1.5.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f7d90c0a9721b0f1b9c13c7a775542d", "sha256": "4b4aaef56debd708d0745c66a4765ca16f02d0e5fe77e00f6a2174e98caf5e15" }, "downloads": -1, "filename": "pure-python-adb-homeassistant-0.1.5.dev0.tar.gz", "has_sig": false, "md5_digest": "6f7d90c0a9721b0f1b9c13c7a775542d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17072, "upload_time": "2018-12-08T17:45:36", "url": "https://files.pythonhosted.org/packages/b2/de/df6f7171bbeea23b638e0760d0b2826871c2d5d97dee3011482587d10b3d/pure-python-adb-homeassistant-0.1.5.dev0.tar.gz" } ], "0.1.6.dev0": [ { "comment_text": "", "digests": { "md5": "5a2d94316afd02e92a57098d8ee02574", "sha256": "9db110a851cce729d84238cfd6af210c43eb028be0bab5bd3d754890f494d616" }, "downloads": -1, "filename": "pure_python_adb_homeassistant-0.1.6.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "5a2d94316afd02e92a57098d8ee02574", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21185, "upload_time": "2019-01-27T19:21:07", "url": "https://files.pythonhosted.org/packages/4e/9f/e4fcaf510afac36e6f1a5be5dbff3271fe271783ccaf3753d4c3009a3353/pure_python_adb_homeassistant-0.1.6.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8d40946f223a6cb9f94c10ad8002d5ac", "sha256": "fe6d90220a6880649f6d6df4e707ce5034676710ee6146145ef995f7b769a482" }, "downloads": -1, "filename": "pure-python-adb-homeassistant-0.1.6.dev0.tar.gz", "has_sig": false, "md5_digest": "8d40946f223a6cb9f94c10ad8002d5ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17581, "upload_time": "2019-01-27T19:21:09", "url": "https://files.pythonhosted.org/packages/90/9b/590a41724039a45f4352249bc578ef9051652a264d09d3e29056e8f7d663/pure-python-adb-homeassistant-0.1.6.dev0.tar.gz" } ], "0.1.7.dev0": [ { "comment_text": "", "digests": { "md5": "f0030dfa98fd88615cdefd56b3832efb", "sha256": "01d22696bc25ab5be553ed6c5f395bf2e99a3a89c0d8357911c78717e3c78e0d" }, "downloads": -1, "filename": "pure_python_adb_homeassistant-0.1.7.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "f0030dfa98fd88615cdefd56b3832efb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21707, "upload_time": "2019-06-28T06:28:05", "url": "https://files.pythonhosted.org/packages/0a/7b/0e0875d32639077028ee81dca8758ea658e4cae025204214e7b5de25d900/pure_python_adb_homeassistant-0.1.7.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec88ae1c182cf0086bb29c6e7c0b2d5c", "sha256": "c575c4a7ca1819c24b4dfa010d4499ac81d2803bc1d841db54c1e81b81e4fadf" }, "downloads": -1, "filename": "pure-python-adb-homeassistant-0.1.7.dev0.tar.gz", "has_sig": false, "md5_digest": "ec88ae1c182cf0086bb29c6e7c0b2d5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18149, "upload_time": "2019-06-28T06:28:06", "url": "https://files.pythonhosted.org/packages/9a/c5/b16784246a99bbe6bb5778c67a72903a2e99b4bec91a46cbfd78993063fc/pure-python-adb-homeassistant-0.1.7.dev0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f0030dfa98fd88615cdefd56b3832efb", "sha256": "01d22696bc25ab5be553ed6c5f395bf2e99a3a89c0d8357911c78717e3c78e0d" }, "downloads": -1, "filename": "pure_python_adb_homeassistant-0.1.7.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "f0030dfa98fd88615cdefd56b3832efb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21707, "upload_time": "2019-06-28T06:28:05", "url": "https://files.pythonhosted.org/packages/0a/7b/0e0875d32639077028ee81dca8758ea658e4cae025204214e7b5de25d900/pure_python_adb_homeassistant-0.1.7.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec88ae1c182cf0086bb29c6e7c0b2d5c", "sha256": "c575c4a7ca1819c24b4dfa010d4499ac81d2803bc1d841db54c1e81b81e4fadf" }, "downloads": -1, "filename": "pure-python-adb-homeassistant-0.1.7.dev0.tar.gz", "has_sig": false, "md5_digest": "ec88ae1c182cf0086bb29c6e7c0b2d5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18149, "upload_time": "2019-06-28T06:28:06", "url": "https://files.pythonhosted.org/packages/9a/c5/b16784246a99bbe6bb5778c67a72903a2e99b4bec91a46cbfd78993063fc/pure-python-adb-homeassistant-0.1.7.dev0.tar.gz" } ] }