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 categories of the given version from Readme.io.
  README_API_KEY env var must be set to correctly get the categories.
  Returns dictionary containing all the categories slugs and their ids.
docstr_tok: ["Fetch","the","categories","of","the","given","version","from","Readme.io",".","README_API_KEY","env","var","must","be","set","to","correctly","get","the","categories",".","Returns","dictionary","containing","all","the","categories","slugs","and","their","ids","."]
code: def _readme_categories(self, version: str) -> t.Dict[str, str]:
      """
      Fetch the categories of the given version from Readme.io.
      README_API_KEY env var must be set to correctly get the categories.
      Returns dictionary containing all the categories slugs and their ids.
      """
      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 category ID"
          )
          return {"haystack-classes": "ID"}
  
      headers = create_headers(version)
  
      res = requests.get(
          "https://dash.readme.com/api/v1/categories",
          headers=headers,
          timeout=60,
      )
  
      if not res.ok:
          sys.exit(f"Error requesting {version} categories")
  
      return {c["slug"]: c["id"] for c in res.json()}
  
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 3 for calling the ReadmeRenderer obj's underlying member method code with example usage: obj._readme_categories(version) and returns: unknown, dict