Created
August 10, 2022 15:57
-
-
Save louis70109/bfc722790051807dac10458f234b0cf3 to your computer and use it in GitHub Desktop.
Format Markdown to Html style by Python and GitHub API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
contents = '' | |
with open("a.md") as f: | |
contents = f.readlines() | |
sum = '' | |
for content in contents: | |
sum += content | |
print(sum) | |
res = requests.post(headers={ | |
"Accept": "application/vnd.github+json", | |
"Authorization": "token GITHUB_KEY" | |
}, url="https://api.github.com/markdown", | |
json={"text": sum}) | |
print(res.status_code) | |
print(res.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment