Skip to content

Commit 4641b45

Browse files
feat: Add idempotency key header to create session requests (appium#514)
1 parent 446b8c4 commit 4641b45

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎appium/webdriver/appium_connection.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import uuid
16+
1517
from selenium.webdriver.remote.remote_connection import RemoteConnection
1618

1719
from appium.common.helper import library_version
@@ -24,5 +26,8 @@ def get_remote_connection_headers(cls, parsed_url, keep_alive=True):
2426
"""Override get_remote_connection_headers in RemoteConnection"""
2527
headers = RemoteConnection.get_remote_connection_headers(parsed_url, keep_alive=keep_alive)
2628
headers['User-Agent'] = 'appium/python {} ({})'.format(library_version(), headers['User-Agent'])
29+
if parsed_url.path.endswith('/session'):
30+
# https://github.com/appium/appium-base-driver/pull/400
31+
headers['X-Idempotency-Key'] = str(uuid.uuid4())
2732

2833
return headers

0 commit comments

Comments
 (0)