docs: def session(context, data):
      """Set some HTTP parameters for all subsequent requests.
  
      This includes ``user`` and ``password`` for HTTP basic authentication,
      and ``user_agent`` as a header.
      """
      context.http.reset()
  
      user = context.get('user')
      password = context.get('password')
  
      if user is not None and password is not None:
          context.http.session.auth = (user, password)
  
      user_agent = context.get('user_agent')
      if user_agent is not None:
          context.http.session.headers['User-Agent'] = user_agent
  
      referer = context.get('url')
      if referer is not None:
          context.http.session.headers['Referer'] = referer
  
      proxy = context.get('proxy')
      if proxy is not None:
          proxies = {'http': proxy, 'https': proxy}
          context.http.session.proxies = proxies
  
      # Explictly save the session because no actual HTTP requests were made.
      context.http.save()
      context.emit(data=data)