Skip to content

Commit

Permalink
Made functions async
Browse files Browse the repository at this point in the history
  • Loading branch information
shbenzer committed Oct 22, 2024
1 parent 26379a0 commit 8bc75c3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions py/selenium/webdriver/common/bidi/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, conn):
self.conn = conn
self.callbacks = {}

def continue_response(self, request_id, status_code, headers=None, body=None):
async def continue_response(self, request_id, status_code, headers=None, body=None):
params = {
'requestId': request_id,
'status': status_code
Expand All @@ -45,9 +45,9 @@ def continue_response(self, request_id, status_code, headers=None, body=None):
params['headers'] = headers
if body is not None:
params['body'] = body
self.conn.execute('network.continueResponse', params)
await self.conn.execute('network.continueResponse', params)

def continue_request(self, request_id, url=None, method=None, headers=None, postData=None):
async def continue_request(self, request_id, url=None, method=None, headers=None, postData=None):
params = {
'requestId': request_id
}
Expand All @@ -59,23 +59,23 @@ def continue_request(self, request_id, url=None, method=None, headers=None, post
params['headers'] = headers
if postData is not None:
params['postData'] = postData
self.conn.execute('network.continueRequest', params)
await self.conn.execute('network.continueRequest', params)

def add_intercept(self, phases=None, contexts=None, url_patterns=None):
async def add_intercept(self, phases=None, contexts=None, url_patterns=None):
if phases is None:
phases = []
params = {
'phases': phases,
'contexts': contexts,
'urlPatterns': url_patterns
}
self.conn.execute('network.addIntercept', params)
await self.conn.execute('network.addIntercept', params)

def remove_intercept(self, intercept):
self.conn.execute('network.removeIntercept', {'intercept': intercept})
async def remove_intercept(self, intercept):
await self.conn.execute('network.removeIntercept', {'intercept': intercept})

def continue_with_auth(self, request_id, username, password):
self.conn.execute(
async def continue_with_auth(self, request_id, username, password):
await self.conn.execute(
'network.continueWithAuth',
{
'request': request_id,
Expand All @@ -88,7 +88,7 @@ def continue_with_auth(self, request_id, username, password):
}
)

def on(self, event, callback):
async def on(self, event, callback):
event = self.EVENTS.get(event, event)
self.callbacks[event] = callback
session_subscribe(self.conn, event, self.handle_event)
await session_subscribe(self.conn, event, self.handle_event)

0 comments on commit 8bc75c3

Please sign in to comment.