Exemplo n.º 1
0
def read_profile(filename: str):
    """
    Liest das angegebene Profil aus. Dort ist auch das verwendete Insulin angegeben.

    :return: Gibt das verwendete Profil zurück.
    """
    # TODO: read the actual Profile instead of Dummy-Object

    return Profile("Humalog", "mg/dl")
Exemplo n.º 2
0
    def get_or_create_profile(self, profile_name):
        profile_model = Profile()
        profile_model.name = profile_name

        profile_entity = Logic.database.get_profile_by_name(profile_model.name)
        if not profile_entity:
            profile_entity_id = Logic.database.create_profile(profile_model)
            profile_entity = Logic.database.get_profile_by_id(
                profile_entity_id)

        return profile_entity
Exemplo n.º 3
0
def _getProfileFromEmail(email):
    user_id = Profile.query(Profile.email == email).fetch(1)
    if len(user_id) > 0:
        print "User Existed"
        return user_id[0]

    else:
        print "New User"
        return Profile(
            name='',
            email='',
            phone='',
            isAlumni='N',
        )
Exemplo n.º 4
0
    def map_profile_query_result(self, query_result):
        profiles = []
        for row in query_result:
            profile = Profile()

            profile.id = int(row[0])
            profile.name = row[1]
            profile.ranked_pp = float(row[2])
            profile.unranked_pp = float(row[3])
            profile.total_pp = float(row[4])
            profile.rank = int(row[5])

            profiles.append(profile)

        return profiles
Exemplo n.º 5
0
import Models.Profile as Profile
import pymongo
import json
import requests
import datetime
import Models.Outbound as Outbound

app = FastAPI()


client = pymongo.MongoClient("mongodb+srv://redants:[email protected]/Whatsapp?retryWrites=true&w=majority")
db = client["Whatsapp"]
collection = db["Profile"]


UserProfile = Profile.Profile()
MessageArray = []


msgg = Outbound.TextMessage()
msgg.type = "text"
msgg.text = "Another one!"


@app.post('/webhook/',  status_code=200)
async def index(DBMessage: Inbound.Message):
    if DBMessage.type == 'message':
        # Check if User Phone number already exists, if exists then add message to user else create user and add message. Search DB for Sender Phone
        DBMessage.payload.payload.direction = "Received"
        DBMessage.payload.payload.type = DBMessage.payload.type
        DBMessage.payload.payload.timestamp = DBMessage.timestamp