class_docstr: This custom Renderer is heavily based on the `MarkdownRenderer`,
  it just prepends a front matter so that the output can be published
  directly to readme.io.
class_docstr_tok: ["This","custom","Renderer","is","heavily","based","on","the","`","MarkdownRenderer","`",",","it","just","prepends","a","front","matter","so","that","the","output","can","be","published","directly","to","readme.io","."]
docstr: Fetch the doc id of the given doc slug and version from Readme.io.
  README_API_KEY env var must be set to correctly get the id.
  If doc_slug is an empty string return an empty string.
docstr_tok: ["Fetch","the","doc","id","of","the","given","doc","slug","and","version","from","Readme.io",".","README_API_KEY","env","var","must","be","set","to","correctly","get","the","id",".","If","doc_slug","is","an","empty","string","return","an","empty","string","."]
code: def _doc_id(self, doc_slug: str, version: str) -> str:
      """
      Fetch the doc id of the given doc slug and version from Readme.io.
      README_API_KEY env var must be set to correctly get the id.
      If doc_slug is an empty string return an empty string.
      """
      if not doc_slug:
          # Not all docs have a parent doc, in case we get no slug
          # we just return an empty string.
          return ""
  
      README_API_KEY = os.getenv("README_API_KEY")
      if not README_API_KEY:
          warnings.warn(
              "README_API_KEY env var is not set, using a placeholder doc ID"
          )
          return "fake-doc-id"
  
      headers = create_headers(version)
      res = requests.get(
          f"https://dash.readme.com/api/v1/docs/{doc_slug}",
          headers=headers,
          timeout=60,
      )
      if not res.ok:
          sys.exit(
              f"Error requesting {doc_slug} doc for version {version}"
          )
  
      return res.json()["id"]
  
imports: import os
  import sys
  import io
  import dataclasses
  import typing
  import base64
  import warnings
  from pathlib import Path
  import requests
  import docspec
  from pydoc_markdown.interfaces import Context, Renderer
  from pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer
label_desc: Use image node_id 4 for calling the ReadmeRenderer obj's underlying member method code with example usage: obj._doc_id(doc_slug, version) and returns: res, str, str