youssef1214 commited on
Commit
82fea0b
·
1 Parent(s): 8a5b597

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -1
main.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI,status,HTTPException
2
  # from .models import lr
3
  import schemas
4
  import Database
@@ -6,6 +6,7 @@ import models
6
  import Cleaning
7
  import pytz
8
  from datetime import datetime
 
9
 
10
 
11
 
@@ -44,6 +45,18 @@ def getemotionCount():
44
  def get_reviews():
45
  data=Database.shakwa_common_words()
46
  return data
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  @app.get('/CommonPlaces')
49
  def get_reviews():
 
1
+ from fastapi import FastAPI,status,HTTPException,Request
2
  # from .models import lr
3
  import schemas
4
  import Database
 
6
  import Cleaning
7
  import pytz
8
  from datetime import datetime
9
+ from firebase_admin import auth
10
 
11
 
12
 
 
45
  def get_reviews():
46
  data=Database.shakwa_common_words()
47
  return data
48
+ @app.post("/updateuser"):
49
+ async def updateuser(request: Request):
50
+ json_data = await request.json()
51
+ if("Uid" in json_data and"email" in json_data and "password" in json_data ):
52
+ user = auth.update_user(
53
+ json_data["Uid"],
54
+ email=json_data["email"],
55
+ password=json_data["password"],
56
+ )
57
+ return('Sucessfully updated user: {0}'.format(user.uid))
58
+ else:
59
+ raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="bad requast missing requied vaules")
60
 
61
  @app.get('/CommonPlaces')
62
  def get_reviews():