python-adb | Python ADB + Fastboot implementation | Android library

 by   google Python Version: 1.3.0 License: Apache-2.0

kandi X-RAY | python-adb Summary

kandi X-RAY | python-adb Summary

python-adb is a Python library typically used in Mobile, Android applications. python-adb has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install python-adb' or download it from GitHub, PyPI.

Note: This is not an official Google project. It is maintained by ex-Google engineers. For a better maintained option, look at [adb_shell] This repository contains a pure-python implementation of the ADB and Fastboot protocols, using libusb1 for USB communications. This is a complete replacement and rearchitecture of the Android project’s [ADB and fastboot code] This code is mainly targeted to users that need to communicate with Android devices in an automated fashion, such as in automated testing. It does not have a daemon between the client and the device, and therefore does not support multiple simultaneous commands to the same device. It does support any number of devices and never communicates with a device that it wasn’t intended to, unlike the Android project’s ADB.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              python-adb has a medium active ecosystem.
              It has 1660 star(s) with 355 fork(s). There are 113 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 52 open issues and 49 have been closed. On average issues are closed in 88 days. There are 20 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of python-adb is 1.3.0

            kandi-Quality Quality

              python-adb has 0 bugs and 0 code smells.

            kandi-Security Security

              python-adb has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              python-adb code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              python-adb is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              python-adb releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              It has 1928 lines of code, 199 functions and 18 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed python-adb and discovered the below as its top functions. This is intended to give you an instant insight into python-adb implemented functionality, and help decide if they suit your requirements.
            • Push data to a file
            • Flush the buffer
            • Reads from the client
            • Reads a single file sync packet
            • Install an apk
            • Run a shell command
            • Create a streaming command
            • Push file to device
            • Run a command on the device
            • Get a service connection
            • Connect to the device
            • Connects to the device
            • Make a subparser for a method
            • Parse a docstring
            • List device files
            • Close the device
            • Read numbytes from the device
            • Find and open a device
            • Get the size of a file
            • Bulk write data to the device
            • Create a matcher for the specified interface
            • Reboot the device
            • List available devices
            • Pull a file
            • Start a USB interface
            • Connect to the server
            Get all kandi verified functions for this library.

            python-adb Key Features

            No Key Features are available at this moment for python-adb.

            python-adb Examples and Code Snippets

            default
            Pythondot img1Lines of Code : 254dot img1no licencesLicense : No License
            copy iconCopy
            class mVars:
                address='C:/Users/EA/Desktop/yixin/'    # 使用到的文件所存放地址
                ip = '10.224.133.140:5555'              #ip 地址,详见adb模块中adb连接教程
            
                boradOne = 67                           #一个相邻落子点的像素间隔
                borad = (65,480)                        #棋盘的初始像素点  

            Community Discussions

            QUESTION

            Sometimes the screenshot image via adb can not be opend
            Asked 2019-May-19 at 15:24

            I am taking some screenshots via adb from my android device (OnePlus 5) to recognize with googles tesseract if there is a specified word inside the page.

            Usually it takes 5-8 screenshots with a 1.5 second delay from each other. The first 2-4 screenshots can be opend but then it throws the error and can´t be opend with PIL, Paint.net or on the phone itself.

            ...

            ANSWER

            Answered 2019-May-19 at 15:24

            What fixed the bug for me was to remove the pgrinder directory in this path: /sdcard/pgrinder/screen.png.

            I thought it would generate the directory if it doesn´t exist but that wasn´t the case. I don´t no why it worked sometimes and sometimes not. But since I changed it, it worked every time.

            Source https://stackoverflow.com/questions/56203655

            QUESTION

            Using Google's Python-ADB over a local network
            Asked 2018-Dec-17 at 14:20

            Pretty self explanatory, as the title says, is there a way to connect to an ADB over TCP enabled device on a network, using Google's Python-ADB library?

            I saw something mentioned in the adb_commands.py file to do with a TCP connection, here is the comment:

            ...

            ANSWER

            Answered 2018-Dec-17 at 14:20

            Yes, simply pass ip:port to the serial positional argument:

            Source https://stackoverflow.com/questions/53811853

            QUESTION

            How to ensure all commands (and errors) handled in order given
            Asked 2018-Nov-11 at 22:33

            TLDR; How do I make a "single-file" asyncio.Queue() and feed it my adb commands, have them executed in the order they're received (one-by-one), handle errors that may occur (disconnect/reconnect) during one of the tasks, and continue processing the rest of the queue after handling the error?

            I'm working on a module that leverages the existing python-adb module to ultimately control my android tablet as a media device and incorporate it into my home automation setup.

            Problem:
            My module is built entirely around async, while the python-adb module is not. The python-adb module also doesn't manage/throttle requests. And I very quickly found out that if multiple adb commands are requested too quickly the adb connection is overloaded, causing an error & requiring a reconnect whenever the disconnect occurred.

            A friend of mine managed to implement a workaround/hack-y solution. Note: self._adb_lock & self._adb_error are initially set in the AndroidDevice class's __init__ function.

            ...

            ANSWER

            Answered 2018-Nov-11 at 22:33

            You need to ensure that only a single task is using the adb connection to execute a command at any given time. This means you need to either use synchronisation primitives to coordinate access, or use a queue to feed a single worker task commands to execute.

            Next, because an adb connection is entirely synchronous and, as with all I/O, relatively slow, I'd use a thread pool executor to run operations on a adb connection off the asyncio loop, so that asyncio is free to run some other tasks that are not currently blocked on I/O. Otherwise, there is no point to putting .Shell() commands in a async def coroutine, you are not actually cooperating and making room for other tasks to be run.

            Last but not least, if even with serialised access to the connection object you find that it can't take too many commands per time period, you would want to use some kind of rate limiting technique. I've created an asyncio leaky bucket algorithm implementation before that can take care of this, if so required.

            Both a queue or a lock would ensure that commands are executed in first-come-first-serve order, but a queue would require some kind of deferred response mechanism to return command results. A queue would let you queue up related commands (you can add multiple entries using queue.put_nowait() without yielding or you can allow grouped commands), without having to wait for a lock first.

            Because you want to retry connections, I'd encapsulate the connection object in a asynchronous context manager, that can then also handle locking and executing commands with an executor:

            Source https://stackoverflow.com/questions/53212210

            QUESTION

            pip install python-adb failed
            Asked 2018-Aug-11 at 13:10

            I want to install Python-adb using pip V9.0.3.

            When Im trying to install python-adb, but I always get the same error as you can see at the bottom.
            I also tried it installing it per CMD with admin rights on pip/pip3.

            What I already tried:
            - CMD with/without admin rights
            - pip/pip3 installation
            - installed mingw for C++ errors

            Im currently using Python3.6 on Windows 7 64Bit

            Output:

            ...

            ANSWER

            Answered 2018-Mar-25 at 22:03

            Apparently M2Crypto (which is where your install process is failing) is kind of hard to install on Windows, but there are unofficial binaries available (though that is a dated question), and the package's own install instructions include a section on Windows installation.

            More promisingly, there is a clone of the project here, which also has Windows instructions. But for that you'll need to have SWIG installed too.

            A third option is this pair (32-bit, 64-bit) of packages that are clones of M2Crypto specifically made for Windows, but I'm not sure how up-to-date they are (the last commit was in 2014, so there might have been a lot of changes to the original project by now).

            Source https://stackoverflow.com/questions/49466965

            QUESTION

            subprocess.check_output fails to execute a command but the same works in windows
            Asked 2017-Mar-19 at 21:18

            I am trying to connect two devices to my pc and run some commands on them using python and adb. when I run the command from the command prompt, it goes through fine, but when i put those in the python script, they give me errors. this is causing the errors all the time:

            ...

            ANSWER

            Answered 2017-Mar-19 at 21:18

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install python-adb

            You can install using 'pip install python-adb' or download it from GitHub, PyPI.
            You can use python-adb like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/google/python-adb.git

          • CLI

            gh repo clone google/python-adb

          • sshUrl

            git@github.com:google/python-adb.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link