Update app.py
Browse files
app.py
CHANGED
|
@@ -147,7 +147,7 @@ async def tgph_create_page(token: str, title: str, markdown_text: str) -> str:
|
|
| 147 |
|
| 148 |
async def tgph_edit_page(token: str, page: str, title: str, markdown_text: str) -> str:
|
| 149 |
content = dumps(md_to_dom(markdown_text))
|
| 150 |
-
|
| 151 |
'access_token': token,
|
| 152 |
'path': page,
|
| 153 |
'title': title,
|
|
@@ -155,11 +155,13 @@ async def tgph_edit_page(token: str, page: str, title: str, markdown_text: str)
|
|
| 155 |
'return_content': False
|
| 156 |
}
|
| 157 |
async with AsyncClient(verify=False, follow_redirects=True, timeout=30.0) as client:
|
| 158 |
-
response = await client.
|
| 159 |
json_response = response.json()
|
| 160 |
if json_response.get('ok'):
|
| 161 |
result = json_response.get('result', {})
|
| 162 |
-
|
|
|
|
|
|
|
| 163 |
|
| 164 |
|
| 165 |
async def download_png(url: str, folder: str, client: AsyncClient, retries: int = 5) -> Path:
|
|
|
|
| 147 |
|
| 148 |
async def tgph_edit_page(token: str, page: str, title: str, markdown_text: str) -> str:
|
| 149 |
content = dumps(md_to_dom(markdown_text))
|
| 150 |
+
data = {
|
| 151 |
'access_token': token,
|
| 152 |
'path': page,
|
| 153 |
'title': title,
|
|
|
|
| 155 |
'return_content': False
|
| 156 |
}
|
| 157 |
async with AsyncClient(verify=False, follow_redirects=True, timeout=30.0) as client:
|
| 158 |
+
response = await client.post(f'{proxy_endpoint}/editPage', data=data)
|
| 159 |
json_response = response.json()
|
| 160 |
if json_response.get('ok'):
|
| 161 |
result = json_response.get('result', {})
|
| 162 |
+
else:
|
| 163 |
+
result = {}
|
| 164 |
+
return result.get('path', '')
|
| 165 |
|
| 166 |
|
| 167 |
async def download_png(url: str, folder: str, client: AsyncClient, retries: int = 5) -> Path:
|