randydev commited on
Commit
570137d
1 Parent(s): 7e20074

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -11
main.py CHANGED
@@ -250,11 +250,9 @@ def get_profile_(
250
  "bio": bio_str
251
  }
252
  }
253
- print(first_name)
254
  else:
255
  return {"status": "false", "message": "Not Found User"}
256
  except Exception as e:
257
- print(str(e))
258
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
259
 
260
  @app.get("/ryuzaki/getbanlist")
@@ -366,8 +364,8 @@ def ryuzaki_ai(
366
 
367
  return {"status": "false", "message": "Invalid response format"}
368
 
369
- except Exception as e:
370
- return {"status": "false", "message": f"error: {e}"}
371
 
372
  @app.get("/ryuzaki/unsplash")
373
  async def get_image_unsplash(query: str, size: str="500x500"):
@@ -377,8 +375,8 @@ async def get_image_unsplash(query: str, size: str="500x500"):
377
  try:
378
  response = requests.get(image_url)
379
  response.raise_for_status()
380
- except requests.exceptions.RequestException as e:
381
- raise HTTPException(status_code=500, detail=f"Error fetching image: {e}")
382
 
383
  return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
384
 
@@ -390,8 +388,8 @@ async def get_image_calligraphy(query: str):
390
  try:
391
  response = requests.get(image_url)
392
  response.raise_for_status()
393
- except requests.exceptions.RequestException as e:
394
- raise HTTPException(status_code=500, detail=f"Error fetching image: {e}")
395
 
396
  return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
397
 
@@ -426,8 +424,8 @@ def google_reverse(
426
  "processed_at": processed_at
427
  }
428
  }
429
- except Exception as e:
430
- return {"status": "false", "message": f"Error {e}"}
431
 
432
  @app.get("/ryuzaki/ocr")
433
  def ocr_space_url(
@@ -733,7 +731,7 @@ def whois_ip_address(ip_address: str=None):
733
  def tiktok_douyin(tiktok_url: str=None):
734
  response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
735
  if response.status_code != 200:
736
- return "Error request:"
737
  try:
738
  download_video = response.json()["aweme_list"][0]["video"]["play_addr"]["url_list"][0]
739
  download_audio = response.json()["aweme_list"][0]["music"]["play_url"]["url_list"][0]
 
250
  "bio": bio_str
251
  }
252
  }
 
253
  else:
254
  return {"status": "false", "message": "Not Found User"}
255
  except Exception as e:
 
256
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
257
 
258
  @app.get("/ryuzaki/getbanlist")
 
364
 
365
  return {"status": "false", "message": "Invalid response format"}
366
 
367
+ except Exception:
368
+ return {"status": "false", "message": "Internal server error"}
369
 
370
  @app.get("/ryuzaki/unsplash")
371
  async def get_image_unsplash(query: str, size: str="500x500"):
 
375
  try:
376
  response = requests.get(image_url)
377
  response.raise_for_status()
378
+ except requests.exceptions.RequestException:
379
+ raise HTTPException(status_code=500, detail="Internal server error")
380
 
381
  return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
382
 
 
388
  try:
389
  response = requests.get(image_url)
390
  response.raise_for_status()
391
+ except requests.exceptions.RequestException:
392
+ raise HTTPException(status_code=500, detail="Internal server error")
393
 
394
  return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
395
 
 
424
  "processed_at": processed_at
425
  }
426
  }
427
+ except Exception:
428
+ return {"status": "false", "message": "Internal server error"}
429
 
430
  @app.get("/ryuzaki/ocr")
431
  def ocr_space_url(
 
731
  def tiktok_douyin(tiktok_url: str=None):
732
  response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
733
  if response.status_code != 200:
734
+ return "Internal server error"
735
  try:
736
  download_video = response.json()["aweme_list"][0]["video"]["play_addr"]["url_list"][0]
737
  download_audio = response.json()["aweme_list"][0]["music"]["play_url"]["url_list"][0]