code: def request(method, url, **kwargs):
      """
      Central place to make any api v2 api request.
  
      :param (str) method: The request method ('get', 'put', 'delete', ...).
      :param (str) url: The full api url to make the request to.
      :param kwargs: These are passed along (but possibly mutated) to requests.
      :return: (requests.Response) The response directly from requests.
  
      """
      kwargs["headers"] = dict(
          kwargs.get("headers", {}), **get_headers()
      )
  
      # Change boolean params to lowercase strings. E.g., `True` --> `'true'`.
      # Just change the value so that requests handles query string creation.
      if isinstance(kwargs.get("params"), dict):
          kwargs["params"] = kwargs["params"].copy()
          for key in kwargs["params"]:
              if isinstance(kwargs["params"][key], bool):
                  kwargs["params"][key] = _json.dumps(
                      kwargs["params"][key]
                  )
  
      # We have a special json encoding class for non-native objects.
      if kwargs.get("json") is not None:
          if kwargs.get("data"):
              raise _plotly_utils.exceptions.PlotlyError(
                  "Cannot supply data and json kwargs."
              )
          kwargs["data"] = _json.dumps(
              kwargs.pop("json"), sort_keys=True, cls=PlotlyJSONEncoder
          )
  
      # The config file determines whether reuqests should *verify*.
      kwargs["verify"] = config.get_config()["plotly_ssl_verification"]
  
      try:
          response = requests.request(method, url, **kwargs)
      except RequestException as e:
          # The message can be an exception. E.g., MaxRetryError.
          message = str(getattr(e, "message", "No message"))
          response = getattr(e, "response", None)
          status_code = response.status_code if response else None
          content = response.content if response else "No content"
          raise exceptions.PlotlyRequestError(
              message, status_code, content
          )
      validate_response(response)
      return response
  
file_path: plotly.py/packages/python/chart-studio/chart_studio/api/v2/utils.py
imports: from __future__ import absolute_import
  import requests
  import json
  from requests.exceptions import RequestException
  from retrying import retry
  import _plotly_utils.exceptions
  from chart_studio import config, exceptions
  from chart_studio.api.utils import basic_auth
  from _plotly_utils.utils import PlotlyJSONEncoder
label_desc: Use image node_id 6 for calling a global function with example usage: request(method, url) and returns: response