class_docstr: Interact with Alibaba Cloud OSS, using the oss2 library.
class_docstr_tok: ["Interact","with","Alibaba","Cloud","OSS",",","using","the","oss2","library","."]
docstr: Upload a local file to OSS.
  
  :param key: the OSS path of the object
  :param file: local file to upload.
  :param bucket_name: the name of the bucket
docstr_tok: ["Upload","a","local","file","to","OSS",".",":","param","key",":","the","OSS","path","of","the","object",":","param","file",":","local","file","to","upload",".",":","param","bucket_name",":","the","name","of","the","bucket"]
code: def upload_local_file(
      self,
      key: str,
      file: str,
      bucket_name: str | None = None,
  ) -> None:
      """
      Upload a local file to OSS.
  
      :param key: the OSS path of the object
      :param file: local file to upload.
      :param bucket_name: the name of the bucket
      """
      try:
          self.get_bucket(bucket_name).put_object_from_file(key, file)
      except Exception as e:
          raise AirflowException(f"Errors when upload file: {e}")
  
imports: from __future__ import annotations
  from functools import wraps
  from inspect import signature
  from typing import TYPE_CHECKING, Callable, TypeVar, cast
  from urllib.parse import urlsplit
  import oss2
  from oss2.exceptions import ClientError
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 7 for calling the OSSHook obj's underlying member method code with example usage: obj.upload_local_file(key, file, bucket_name) without return types