import os
import json
import requests
# List your markdown directories here.
dirs = [
'xxx',
'xxx'
]
for file_dir in dirs:
filenames = os.listdir(file_dir)
for i in range(0, len(filenames)):
if filenames[i].startswith('.'):
continue
file_name = filenames[i]
if '.md' in file_name:
file_name = file_name[:-3]
print(file_name)
path = os.path.join(file_dir, filenames[i])
f = open(path)
file_content = f.read()
url = 'https://api.github.com/repos/%s/%s/issues' % ('your username', 'your repo name')
session = requests.session()
session.auth = ('your username', 'you password')
title = file_name
issue = {
'title': file_name,
'body': file_content,
'labels': [],
'milestone': None
}
r = session.post(url, json.dumps(issue))
if r.status_code == 201:
print('Successfully created Issue "%s"' % title)
# os.remove(path)
else:
print('Could not create Issue "%s"' % title)
print('Response:', r.content)
How to import markdown files into github issue using Python script?
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本测试尝试用cosmos-sdk的最新版本在本地构建一个两个节点(fincoin和fabcoin)的区块链(fin...
- On Windows 10, PowerShell is a powerful scripting tool, w...
- How to automatically add a schedule from Google sheets to...
- pip命令突然就不好使了,问题原因可能是电脑里有多个版本的Python,但我找半天也没发现除了anaconda之外...
- title: "How do I add a hyperlink with spaces in it using ...