added endpoint for getting user data by user_id (#208)

Co-authored-by: Captain <Captain@PC>
remotes/1693045480750635534/spooky-22
bAWario 2022-02-13 20:50:39 +01:00 committed by GitHub
parent faaaca4cf3
commit fa926d2e23
1 changed files with 12 additions and 0 deletions

View File

@ -888,6 +888,18 @@ def u_username_info(username, v=None):
return user.json
@app.get("/<id>/info")
@auth_required
def u_user_id_info(id, v=None):
user=get_account(id, v=v)
if hasattr(user, 'is_blocking') and user.is_blocking:
return {"error": "You're blocking this user."}, 401
elif hasattr(user, 'is_blocked') and user.is_blocked:
return {"error": "This user is blocking you."}, 403
return user.json
@app.post("/follow/<username>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")