|
15 | 15 |
|
16 | 16 |
|
17 | 17 | def upload_doc(path, section):
|
18 |
| - title = path.split('/')[-1].replace(".ipynb", '').capitalize().replace('_', ' ') |
| 18 | + title = path.split('/')[-1].replace(".ipynb", |
| 19 | + '').capitalize().replace('_', ' ') |
19 | 20 |
|
20 | 21 | with open(path) as fb:
|
21 | 22 | nb = nbformat.reads(json.dumps(json.load(fb)), as_version=4)
|
@@ -73,29 +74,29 @@ def make_sections(sections):
|
73 | 74 |
|
74 | 75 |
|
75 | 76 | def change_name(slug, title, headers):
|
76 |
| - resp = requests.put( |
77 |
| - f'{README_DOC_ENDPOINT}/{slug}', |
78 |
| - json={ |
79 |
| - "title": title, |
80 |
| - "category": CATEGORY_ID |
81 |
| - }, |
82 |
| - headers=headers |
83 |
| - ) |
| 77 | + resp = requests.put(f'{README_DOC_ENDPOINT}/{slug}', |
| 78 | + json={ |
| 79 | + "title": title, |
| 80 | + "category": CATEGORY_ID |
| 81 | + }, |
| 82 | + headers=headers) |
84 | 83 | resp.raise_for_status()
|
85 | 84 |
|
86 | 85 |
|
87 | 86 | def erase_category_docs(cat_slug):
|
88 |
| - headers = { |
89 |
| - "Accept": "application/json", |
90 |
| - "Authorization": README_AUTH |
91 |
| - } |
| 87 | + headers = {"Accept": "application/json", "Authorization": README_AUTH} |
92 | 88 |
|
93 |
| - response = requests.request("GET", f'https://dash.readme.com/api/v1/categories/{cat_slug}/docs', headers=headers) |
| 89 | + response = requests.request( |
| 90 | + "GET", |
| 91 | + f'https://dash.readme.com/api/v1/categories/{cat_slug}/docs', |
| 92 | + headers=headers) |
94 | 93 | docs = response.json()
|
95 | 94 | for doc in docs:
|
96 | 95 | for child in doc["children"]:
|
97 |
| - resp = requests.delete(f'{README_DOC_ENDPOINT}/{child["slug"]}', headers=headers) |
98 |
| - resp = requests.delete(f'{README_DOC_ENDPOINT}/{doc["slug"]}', headers=headers) |
| 96 | + resp = requests.delete(f'{README_DOC_ENDPOINT}/{child["slug"]}', |
| 97 | + headers=headers) |
| 98 | + resp = requests.delete(f'{README_DOC_ENDPOINT}/{doc["slug"]}', |
| 99 | + headers=headers) |
99 | 100 |
|
100 | 101 |
|
101 | 102 | @click.command()
|
|
0 commit comments