class_docstr: Data provider communicating with API server.
class_docstr_tok: ["Data","provider","communicating","with","API","server","."]
code: def finish_experiment(self, experiment):
      if isinstance(experiment, str):
          key = experiment
      else:
          key = experiment.key
  
      headers = self._get_headers()
  
      def post_request():
          request = requests.post(
              self.url + "/api/finish_experiment",
              headers=headers,
              data=json.dumps({"key": key}),
          )
          self._raise_detailed_error(request)
  
      retry(post_request, sleep_time=10, logger=self.logger)
      if not isinstance(experiment, str):
          experiment.time_finished = time.time()
  
imports: import requests
  import json
  import time
  import re
  from studio.util import logs
  from studio.auth import get_auth
  from studio.credentials.credentials import Credentials
  from studio.storage.storage_setup import get_storage_verbose_level
  from studio.storage.http_storage_handler import HTTPStorageHandler
  from studio.experiments.experiment import experiment_from_dict
  from studio.util.util import retry, check_for_kb_interrupt
label_desc: Use image node_id 8 for calling the HTTPProvider obj's underlying member method code with example usage: obj.finish_experiment(experiment) without return types