Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created October 5, 2021 16:26
Show Gist options
  • Save kyanny/cd0bfb9f4bf0eea8d54f3a6e039f1459 to your computer and use it in GitHub Desktop.
Save kyanny/cd0bfb9f4bf0eea8d54f3a6e039f1459 to your computer and use it in GitHub Desktop.
import urllib.request
import os
import json
token = os.getenv('GITHUB_TOKEN')
data = {
'text': '**hello** __world__',
}
headers = {
'Content-Type': 'application/json',
'Authorization': f'token {token}'
}
url = 'https://api.github.com/markdown'
req = urllib.request.Request(url, json.dumps(data).encode(), headers)
with urllib.request.urlopen(req) as res:
print(res.read().decode('utf8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment