navpan2 commited on
Commit
13f8b0d
·
1 Parent(s): 1dd53f9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -9
main.py CHANGED
@@ -1,6 +1,6 @@
1
  import random
2
  from fastapi import FastAPI, HTTPException
3
- import httpx
4
 
5
  app = FastAPI()
6
  def randomer():
@@ -310,13 +310,12 @@ async def root():
310
  return {"message": "Welcome to dailymo requestor"}
311
  @app.get("/fetcher/")
312
  async def fetcher():
313
- try:
314
- url = "https://dailymo1.onrender.com/getf/?videourl="+randomer()
315
- async with httpx.AsyncClient() as client:
316
- response = await client.get(url)
317
- response.raise_for_status() # Raises an HTTPError for bad responses
318
- return response.text
319
- except httpx.HTTPError as e:
320
- raise HTTPException(status_code=e.response.status_code, detail=str(e))
321
 
322
 
 
1
  import random
2
  from fastapi import FastAPI, HTTPException
3
+ import requests
4
 
5
  app = FastAPI()
6
  def randomer():
 
310
  return {"message": "Welcome to dailymo requestor"}
311
  @app.get("/fetcher/")
312
  async def fetcher():
313
+
314
+ url = "https://dailymo1.onrender.com/getf/?videourl="+randomer()
315
+
316
+ response = requests.get(url)
317
+ # Raises an HTTPError for bad responses
318
+ return response.text
319
+
 
320
 
321