Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ from fastapi import FastAPI, HTTPException
|
|
11 |
from fastapi.responses import PlainTextResponse
|
12 |
from httpx import AsyncClient, HTTPStatusError, RequestError
|
13 |
from pydantic import BaseModel, HttpUrl
|
|
|
14 |
from aiorentry.client import Client as RentryClient
|
15 |
from uvicorn import run as uvicorn_run
|
16 |
|
@@ -171,7 +172,8 @@ async def optimize_and_upload(images_urls: List[str] | str, convert: bool = Fals
|
|
171 |
page = await client.new_page('content')
|
172 |
page_id, code = page.url, page.edit_code
|
173 |
continue_task = create_task(continue_optimizing_and_uploading(images_urls, page_id, code))
|
174 |
-
|
|
|
175 |
else:
|
176 |
return await continue_optimizing_and_uploading(images_urls)
|
177 |
|
@@ -208,12 +210,10 @@ async def continue_optimizing_and_uploading(images_urls: list[str], page_id: str
|
|
208 |
url=page_id,
|
209 |
edit_code=code,
|
210 |
)
|
211 |
-
print(f'https://rentry.co/{page_id}', f'https://rentry.org/{page_id}')
|
212 |
-
return [f'https://rentry.co/{page_id}', f'https://rentry.org/{page_id}']
|
213 |
except Exception as e:
|
214 |
print(f'не удалось создать страницу в rentry: {e}')
|
215 |
|
216 |
-
return new_images_urls
|
217 |
|
218 |
|
219 |
app = FastAPI()
|
|
|
11 |
from fastapi.responses import PlainTextResponse
|
12 |
from httpx import AsyncClient, HTTPStatusError, RequestError
|
13 |
from pydantic import BaseModel, HttpUrl
|
14 |
+
# from ytelegraph import TelegraphAPI
|
15 |
from aiorentry.client import Client as RentryClient
|
16 |
from uvicorn import run as uvicorn_run
|
17 |
|
|
|
172 |
page = await client.new_page('content')
|
173 |
page_id, code = page.url, page.edit_code
|
174 |
continue_task = create_task(continue_optimizing_and_uploading(images_urls, page_id, code))
|
175 |
+
print(f'https://rentry.co/{page_id}', f'https://rentry.org/{page_id}')
|
176 |
+
return [f'https://rentry.co/{page_id}', f'https://rentry.org/{page_id}']
|
177 |
else:
|
178 |
return await continue_optimizing_and_uploading(images_urls)
|
179 |
|
|
|
210 |
url=page_id,
|
211 |
edit_code=code,
|
212 |
)
|
|
|
|
|
213 |
except Exception as e:
|
214 |
print(f'не удалось создать страницу в rentry: {e}')
|
215 |
|
216 |
+
return new_images_urls if len(new_images_urls) > 0 and new_images_urls[0] else images_urls
|
217 |
|
218 |
|
219 |
app = FastAPI()
|