|
4 | 4 | import xml.etree.ElementTree as ET
|
5 | 5 | from contextlib import closing
|
6 | 6 | from pathlib import Path
|
| 7 | +from typing import Optional |
7 | 8 |
|
8 | 9 | import click
|
9 | 10 | import inquirer3
|
10 | 11 | import requests
|
| 12 | +from requests.structures import CaseInsensitiveDict |
11 | 13 |
|
12 | 14 | from pymobiledevice3.exceptions import MobileActivationException
|
13 |
| -from pymobiledevice3.lockdown import create_using_usbmux |
14 | 15 | from pymobiledevice3.lockdown_service_provider import LockdownServiceProvider
|
15 | 16 |
|
16 | 17 | ACTIVATION_USER_AGENT_IOS = 'iOS Device Activator (MobileActivation-20 built on Jan 15 2012 at 19:07:28)'
|
@@ -136,17 +137,18 @@ def activate_with_session(self, activation_record, headers):
|
136 | 137 | }
|
137 | 138 | if headers:
|
138 | 139 | data['ActivationResponseHeaders'] = dict(headers)
|
139 |
| - with closing(create_using_usbmux(self.lockdown.udid).start_lockdown_service(self.SERVICE_NAME)) as service: |
| 140 | + with closing(self.lockdown.start_lockdown_service(self.SERVICE_NAME)) as service: |
140 | 141 | return service.send_recv_plist(data)
|
141 | 142 |
|
142 |
| - def send_command(self, command, value=''): |
| 143 | + def send_command(self, command: str, value: str = ''): |
143 | 144 | data = {'Command': command}
|
144 | 145 | if value:
|
145 | 146 | data['Value'] = value
|
146 |
| - with closing(create_using_usbmux(self.lockdown.udid).start_lockdown_service(self.SERVICE_NAME)) as service: |
| 147 | + with closing(self.lockdown.start_lockdown_service(self.SERVICE_NAME)) as service: |
147 | 148 | return service.send_recv_plist(data)
|
148 | 149 |
|
149 |
| - def post(self, url, data, headers=None): |
| 150 | + def post(self, url: str, data: dict, headers: Optional[CaseInsensitiveDict[str, str]] = None) \ |
| 151 | + -> tuple[bytes, CaseInsensitiveDict[str]]: |
150 | 152 | if headers is None:
|
151 | 153 | headers = DEFAULT_HEADERS
|
152 | 154 |
|
|
0 commit comments