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