getapi commited on
Commit
4c8231e
1 Parent(s): 808b0b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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
- params = {
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.get(f'{proxy_endpoint}/editPage', params=params)
159
  json_response = response.json()
160
  if json_response.get('ok'):
161
  result = json_response.get('result', {})
162
- return result.get('path')
 
 
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: