class_docstr: Provides a uniform interface to communicate with the Lightly API.
  
  The APIWorkflowClient is used to communicate with the Lightly API. The client
  can run also more complex workflows which include multiple API calls at once.
  
  The client can be used in combination with the active learning agent.
  
  Args:
      token:
          The token of the user. If it is not passed in during initialization, the token
          will be read from the environment variable LIGHTLY_TOKEN.
          For further information on how to get a token,
          see: https://docs.lightly.ai/docs/install-lightly#api-token
      dataset_id:
          The id of the dataset. If it is not set, but used by a workflow, the last
          modfied dataset is taken by default.
      embedding_id:
          The id of the embedding to use. If it is not set, but used by a workflow,
          the newest embedding is taken by default
      creator:
          Creator passed to API requests.
class_docstr_tok: ["Provides","a","uniform","interface","to","communicate","with","the","Lightly","API",".","The","APIWorkflowClient","is","used","to","communicate","with","the","Lightly","API",".","The","client","can","run","also","more","complex","workflows","which","include","multiple","API","calls","at","once",".","The","client","can","be","used","in","combination","with","the","active","learning","agent",".","Args",":","token",":","The","token","of","the","user",".","If","it","is","not","passed","in","during","initialization",",","the","token","will","be","read","from","the","environment","variable","LIGHTLY_TOKEN",".","For","further","information","on","how","to","get","a","token",",","see",":","https",":","\/\/docs.lightly.ai\/docs\/install-lightly","#","api-token","dataset_id",":","The","id","of","the","dataset",".","If","it","is","not","set",",","but","used","by","a","workflow",",","the","last","modfied","dataset","is","taken","by","default",".","embedding_id",":","The","id","of","the","embedding","to","use",".","If","it","is","not","set",",","but","used","by","a","workflow",",","the","newest","embedding","is","taken","by","default","creator",":","Creator","passed","to","API","requests","."]
docstr: Uploads a file to a url via a put request.
  
  This method cannot upload 0 bytes files due to a limitation of the requests
  library. Set file to None to upload an empty file.
  
  Args:
      file:
          The file to upload. If None, an empty file is uploaded.
      signed_write_url:
          The url to upload the file to. As no authorization is used,
          the url must be a signed write url.
      headers:
          Specific headers for the request. Defaults to None.
      session:
          Optional requests session used to upload the file.
  
  Returns:
      The response of the put request.
  
  :meta private:  # Skip docstring generation
docstr_tok: ["Uploads","a","file","to","a","url","via","a","put","request",".","This","method","can","not","upload","0","bytes","files","due","to","a","limitation","of","the","requests","library",".","Set","file","to","None","to","upload","an","empty","file",".","Args",":","file",":","The","file","to","upload",".","If","None",",","an","empty","file","is","uploaded",".","signed_write_url",":","The","url","to","upload","the","file","to",".","As","no","authorization","is","used",",","the","url","must","be","a","signed","write","url",".","headers",":","Specific","headers","for","the","request",".","Defaults","to","None",".","session",":","Optional","requests","session","used","to","upload","the","file",".","Returns",":","The","response","of","the","put","request",".",":","meta","private",":","#","Skip","docstring","generation"]
code: def upload_file_with_signed_url(
      self,
      file: Union[IOBase, None],
      signed_write_url: str,
      headers: Optional[Dict] = None,
      session: Optional[requests.Session] = None,
  ) -> Response:
      """Uploads a file to a url via a put request.
  
      This method cannot upload 0 bytes files due to a limitation of the requests
      library. Set file to None to upload an empty file.
  
      Args:
          file:
              The file to upload. If None, an empty file is uploaded.
          signed_write_url:
              The url to upload the file to. As no authorization is used,
              the url must be a signed write url.
          headers:
              Specific headers for the request. Defaults to None.
          session:
              Optional requests session used to upload the file.
  
      Returns:
          The response of the put request.
  
      :meta private:  # Skip docstring generation
      """
  
      # check to see if server side encryption for S3 is desired
      # see https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingServerSideEncryption.html
      # see https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html
      lightly_s3_sse_kms_key = os.environ.get(
          LIGHTLY_S3_SSE_KMS_KEY, ""
      ).strip()
      # Only set s3 related headers when we are talking with s3
      if (
          utils.get_signed_url_destination(signed_write_url)
          == DatasourceType.S3
          and lightly_s3_sse_kms_key
      ):
          if headers is None:
              headers = {}
          # don't override previously set SSE
          if "x-amz-server-side-encryption" not in headers:
              if lightly_s3_sse_kms_key.lower() == "true":
                  # enable SSE with the key of amazon
                  headers["x-amz-server-side-encryption"] = "AES256"
              else:
                  # enable SSE with specific customer KMS key
                  headers["x-amz-server-side-encryption"] = "aws:kms"
                  headers[
                      "x-amz-server-side-encryption-aws-kms-key-id"
                  ] = lightly_s3_sse_kms_key
  
      # start requests session and make put request
      sess = session or requests
      if headers is not None:
          response = sess.put(
              signed_write_url, data=file, headers=headers
          )
      else:
          response = sess.put(signed_write_url, data=file)
      response.raise_for_status()
      return response
  
imports: import os
  import platform
  import warnings
  from io import IOBase
  from typing import *
  import requests
  from requests import Response
  from urllib3.exceptions import HTTPError
  from lightly.__init__ import __version__
  from lightly.api import _version_checking, utils
  from lightly.api.api_workflow_artifacts import _ArtifactsMixin
  from lightly.api.api_workflow_collaboration import _CollaborationMixin
  from lightly.api.api_workflow_compute_worker import _ComputeWorkerMixin
  from lightly.api.api_workflow_datasets import _DatasetsMixin
  from lightly.api.api_workflow_datasources import _DatasourcesMixin
  from lightly.api.api_workflow_download_dataset import _DownloadDatasetMixin
  from lightly.api.api_workflow_export import _ExportDatasetMixin
  from lightly.api.api_workflow_predictions import _PredictionsMixin
  from lightly.api.api_workflow_selection import _SelectionMixin
  from lightly.api.api_workflow_tags import _TagsMixin
  from lightly.api.api_workflow_upload_embeddings import _UploadEmbeddingsMixin
  from lightly.api.api_workflow_upload_metadata import _UploadCustomMetadataMixin
  from lightly.api.swagger_api_client import LightlySwaggerApiClient
  from lightly.api.utils import DatasourceType
  from lightly.openapi_generated.swagger_client.api import CollaborationApi, DatasetsApi, DatasourcesApi, DockerApi, EmbeddingsApi, JobsApi, MappingsApi, MetaDataConfigurationsApi, PredictionsApi, QuotaApi, SamplesApi, SamplingsApi, ScoresApi, TagsApi
  from lightly.openapi_generated.swagger_client.models import Creator, DatasetData
  from lightly.openapi_generated.swagger_client.rest import ApiException
  from lightly.utils import reordering
label_desc: Use image node_id 6 for calling the ApiWorkflowClient obj's underlying member method code with example usage: obj.upload_file_with_signed_url(file, signed_write_url, headers, session) and returns: response