@open_tab
def load_page(data, socket):
 if ('url' not in data):
  return {'error': 4001, 'message': 'Required parameter url'}
 socket.tab.loaded = False
 meta = data.get('_meta', {})
 def on_complete(is_error, error_info=None):
  extra_meta = {'id': meta.get('id')}
  if is_error:
   msg = ('Unknown error' if (error_info is None) else error_info.text)
   extra_meta.update(error=4500, reason=msg)
  else:
   socket.tab.loaded = True
  socket.sendMessage(metadata(socket, extra_meta))
  cookies(socket)
 headers = {}
 if ('user_agent' in meta):
  headers['User-Agent'] = meta['user_agent']
 socket.tab.go(data['url'], (lambda : on_complete(False)), (lambda err=None: on_complete(True, err)), baseurl=data.get('baseurl'), headers=headers)

@ open_tab def load_page ( data , socket ) : if ( 'url' not in data ) : return { 'error' : 4001 , 'message' : 'Required parameter url' } socket . tab . loaded = False meta = data . get ( '_meta' , { } ) def on_complete ( is_error , error_info = None ) : extra_meta = { 'id' : meta . get ( 'id' ) } if is_error : msg = ( 'Unknown error' if ( error_info is None ) else error_info . text ) extra_meta . update ( error = 4500 , reason = msg ) else : socket . tab . loaded = True socket . sendMessage ( metadata ( socket , extra_meta ) ) cookies ( socket ) headers = { } if ( 'user_agent' in meta ) : headers [ 'User-Agent' ] = meta [ 'user_agent' ] socket . tab . go ( data [ 'url' ] , ( lambda : on_complete ( False ) ) , ( lambda err = None : on_complete ( True , err ) ) , baseurl = data . get ( 'baseurl' ) , headers = headers )
load page in virtual url from provided url .