Download OneApi/database/methods/user_info.py from dragxd/oneapi: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/spaces/dragxd/oneapi/resolve/main/OneApi/database/methods/user_info.py
- Command line
-
hf download hf://spaces/dragxd/oneapi/OneApi/database/methods/user_info.py
-
curl -L -o user_info.py https://huggingface.co/spaces/dragxd/oneapi/resolve/main/OneApi/database/methods/user_info.py
502 Bytes
| import traceback | |
| import logging | |
| import httpx | |
| class UserInfo: | |
| async def user_info(self, user_id): | |
| try: | |
| from ..user import db | |
| user = await self.find(user_id) | |
| if not user: return "not exists" | |
| data = { | |
| "name": user.get('name'), | |
| "coins": user.get('coins'), | |
| "projects": len(user.get('projects')), | |
| "git": user.get('git') | |
| } | |
| return data | |
| except Exception as w: | |
| logging.error(traceback.format_exc()) | |
| return f'Error: {w}' | |