def getDetails(person): person_dict = {} person_dict['FName'] = person.first_name person_dict['LName'] = person.last_name person_dict['Email'] = person.email person_dict['PhoneNo'] = person.phone_no person_data = {} person_data['res'] = person_dict scriptpath = os.path.dirname('./static/JSON/temp/') fName = os.path.join(scriptpath, 'Userdata.json') WritingToJson.writeJSON(person_data, fName) return True
def fetch_contacts(person): data_new = {} dataDB = {"result": []} count = {} value = 0 count["count"] = "0" cursor = connection.cursor() cursor.execute("SELECT * from pahera_trusted_friends WHERE person_id = %s", [person.id]) friend_Data = {} friend_Data = DictFetchAll.dictfetchall(cursor) for post in friend_Data: value += 1 post["count"] = value dataDB["result"].append(post) count["count"] = value scriptpath = os.path.dirname("./static/JSON/temp/") fName = os.path.join(scriptpath, "MyContacts.json") WritingToJson.writeJSON2(dataDB, fName)