Akane710 commited on
Commit
0f25724
·
verified ·
1 Parent(s): cfac740

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -2
main.py CHANGED
@@ -5,6 +5,7 @@ from enkanetwork import EnkaNetworkAPI
5
  from starrailcard.src.api import enka
6
  import concurrent.futures
7
  import requests
 
8
  from fastapi import FastAPI,Query
9
  from io import BytesIO
10
  from fastapi.responses import JSONResponse
@@ -146,10 +147,14 @@ def root():
146
  async def root():
147
  try:
148
  # Update assets using encbanner
149
- result = await encbanner.update() # Await the async update method
150
  return JSONResponse(content={'response': 'Assets updated successfully', 'result': result})
151
  except Exception as e:
152
- return JSONResponse(content={'error': 'UNKNOWN ERR: ' + str(e)}, status_code=500)
 
 
 
 
153
 
154
  # Helper function to upload the image to Cloudinary
155
  def upload_image(data, character_id, player_id):
 
5
  from starrailcard.src.api import enka
6
  import concurrent.futures
7
  import requests
8
+ import traceback
9
  from fastapi import FastAPI,Query
10
  from io import BytesIO
11
  from fastapi.responses import JSONResponse
 
147
  async def root():
148
  try:
149
  # Update assets using encbanner
150
+ result = await encbanner.update()
151
  return JSONResponse(content={'response': 'Assets updated successfully', 'result': result})
152
  except Exception as e:
153
+ error_details = traceback.format_exc()
154
+ return JSONResponse(
155
+ content={'error': f'UNKNOWN ERR: {str(e)}', 'details': error_details},
156
+ status_code=500
157
+ )
158
 
159
  # Helper function to upload the image to Cloudinary
160
  def upload_image(data, character_id, player_id):