-
Notifications
You must be signed in to change notification settings - Fork 566
Rebase python3 branch with master #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6e1a2a7
53dc75f
3359a44
4d269f8
b95776d
f2bf259
864b045
f14291b
446b8c4
4641b45
34427a1
5a545d7
2141dbd
9bdf1f7
ba64adf
9e1959c
a2e21d1
c702cef
cfd99cf
569342e
c8d1af3
91a26e8
e800ce7
efd0655
c378859
56e8e0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = '0.49' | ||
version = '0.52' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,19 +12,26 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Any, Dict | ||
import uuid | ||
from typing import TYPE_CHECKING, Any, Dict | ||
|
||
from selenium.webdriver.remote.remote_connection import RemoteConnection | ||
|
||
from appium.common.helper import library_version | ||
|
||
if TYPE_CHECKING: | ||
from urllib.parse import ParseResult | ||
|
||
|
||
class AppiumConnection(RemoteConnection): | ||
|
||
@classmethod | ||
def get_remote_connection_headers(cls, parsed_url: str, keep_alive: bool = True) -> Dict[str, Any]: | ||
def get_remote_connection_headers(cls, parsed_url: 'ParseResult', keep_alive: bool = True) -> Dict[str, Any]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love mypy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice catch by mypy. |
||
"""Override get_remote_connection_headers in RemoteConnection""" | ||
headers = RemoteConnection.get_remote_connection_headers(parsed_url, keep_alive=keep_alive) | ||
headers['User-Agent'] = 'appium/python {} ({})'.format(library_version(), headers['User-Agent']) | ||
if parsed_url.path.endswith('/session'): | ||
# https://github.com/appium/appium-base-driver/pull/400 | ||
headers['X-Idempotency-Key'] = str(uuid.uuid4()) | ||
|
||
return headers |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,7 @@ def start(self, **kwargs: Any) -> sp.Popen: | |
if not self.is_running or (timeout_ms > 0 and not poll_url(host, port, STATUS_URL, timeout_ms)): | ||
error_msg = f'Appium has failed to start on {host}:{port} within {timeout_ms}ms timeout' | ||
if error_msg is not None: | ||
if stderr == sp.PIPE: | ||
if stderr == sp.PIPE and self._process.stderr is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Notes] To fix mypy error |
||
err_output = self._process.stderr.read() | ||
if err_output: | ||
error_msg += f'\nOriginal error: {str(err_output)}' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to mention that this is the last version supporting Python 2 (because of its EOL)