randydev commited on
Commit
309ab24
1 Parent(s): f593d1d

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +26 -21
main.py CHANGED
@@ -245,28 +245,33 @@ def get_profile_(
245
  user_id: int = Query(..., description="User ID in query parameter"),
246
  api_key: None = Depends(validate_api_key)
247
  ):
248
- first_name, last_name, profile_id, bio = get_profile_clone(user_id)
249
- if last_name is None:
250
- last_name_str = ""
251
- else:
252
- last_name_str = last_name
253
- if bio is None:
254
- bio_str = ""
255
- else:
256
- bio_str = bio
257
- if all([first_name, last_name_str, profile_id, bio_str]):
258
- return {
259
- "status": "true",
260
- "randydev": {
261
- "user_id": user_id,
262
- "first_name": first_name,
263
- "last_name": last_name_str,
264
- "profile_id": profile_id,
265
- "bio": bio_str
 
 
266
  }
267
- }
268
- else:
269
- return {"status": "false", "message": "Not Found User"}
 
 
 
270
 
271
  @app.get("/ryuzaki/getbanlist")
272
  def sibyl_get_all_banlist():
 
245
  user_id: int = Query(..., description="User ID in query parameter"),
246
  api_key: None = Depends(validate_api_key)
247
  ):
248
+ try:
249
+ first_name, last_name, profile_id, bio = get_profile_clone(user_id)
250
+ if last_name is None:
251
+ last_name_str = ""
252
+ else:
253
+ last_name_str = last_name
254
+ if bio is None:
255
+ bio_str = ""
256
+ else:
257
+ bio_str = bio
258
+ if all([first_name, last_name_str, profile_id, bio_str]):
259
+ return {
260
+ "status": "true",
261
+ "randydev": {
262
+ "user_id": user_id,
263
+ "first_name": first_name,
264
+ "last_name": last_name_str,
265
+ "profile_id": profile_id,
266
+ "bio": bio_str
267
+ }
268
  }
269
+ print(first_name)
270
+ else:
271
+ return {"status": "false", "message": "Not Found User"}
272
+ except Exception as e:
273
+ print(str(e))
274
+ return {"status": "false", "message": f"Internal server error: {str(e)}"}
275
 
276
  @app.get("/ryuzaki/getbanlist")
277
  def sibyl_get_all_banlist():