code: def upload(self, path, category, recursive=False):
      self.__verify_category_exists(category)
  
      if os.path.isdir(path):
          if recursive:
              # get all subdirs in path and recursively transfer all files in that subdir
              subdirpath = path
              onlydirs = [
                  f
                  for f in os.listdir(subdirpath)
                  if os.path.isdir(os.path.join(subdirpath, f))
              ]
              for dir in onlydirs:
                  self.upload(
                      os.path.join(path, dir), category, recursive
                  )
  
          # get all filenames in current dir
          files = sorted(
              [
                  os.path.join(path, f)
                  for f in os.listdir(path)
                  if os.path.isfile(os.path.join(path, f))
              ]
          )
  
          # iterate through all filenames and import the html files
          for currfilename in files:
              self.upload(currfilename, category, recursive)
      elif not os.path.isfile(path):
          raise ValueError("Unable to find file at path: " + path)
  
      currfilename = path
      if currfilename.find(".html") != -1:
          # open and read file
          file = open(currfilename, "r")
          filecontents = file.read()
          file.close()
          filecontents = filecontents.replace("\\", "&#92;")
          filecontents = filecontents.replace("\n", "\\\\n")
          filecontents = filecontents.replace("¶", "")
          filecontents = filecontents.replace('"', "'")
          filecontents = (
              '[block:html]\\n{\\n \\"html\\": \\"'
              + filecontents
              + '\\"\\n}\\n[/block]'
          )
  
          firstheadline = os.path.basename(currfilename)[:-5]
          # extract first heading and use as page title
          # soup = BeautifulSoup(filecontents, 'html.parser')
          # for headlines in soup.find_all("h1"):
          # 	firstheadline = headlines.text.strip()
          # 	break
  
          # Delete files with identical title
          self.delete_file_with_title(firstheadline, category)
  
          # Set up HTML _reamde_api_url for ReadMe API
          data = {
              "hidden": "false",
              "title": firstheadline,
              "type": "basic",
              "body": filecontents,
              "category": self.get_category(category)["_id"],
          }
  
          # Create the new page
          out = self.__api_POST(
              "docs",
              data,
              "Uploading " + currfilename + " to category " + category,
          )
          self.get_category_files(category)[firstheadline] = out
  
imports: import json
  import os
  from requests.auth import HTTPBasicAuth
  import requests
label_desc: Use image node_id 21 for calling the ReadMeSession obj's underlying member method code with example usage: obj.upload(path, category, recursive) without return types