github-flavored-markdown-to-html icon indicating copy to clipboard operation
github-flavored-markdown-to-html copied to clipboard

Add authentication

Open fadden opened this issue 1 year ago • 0 comments

The current github REST API has a limit of 60 requests per hour. This isn't a lot if you're iterating on development of a batch documentation converter. Authentication raises the limit to 5000/hour.

The core of the required change is to add two items to the headers dictionary in the markdown_to_html_via_github_api function:

    headers = {"Content-Type": "text/plain", "charset": "utf-8",
            "Authorization": "Bearer github_pat_####",
            "X-GitHub-Api-Version": "2022-11-28"
            }

where "github_pat_####" is replaced by a generated personal access token, which would be provided on the command line.

fadden avatar Sep 23 '24 00:09 fadden