def InsertUser(): name = request.form.get('name') lastname = request.form.get('lastname') mail = request.form.get('mail') password = request.form.get('password') user = User("NULL", name, lastname, mail, password) user.InsertUser(name, lastname, mail, password) return redirect("/user")
def home(): active = False user = User('', '', '', '', '') if 'idUser' in session: active = True user = User.SelectUserID(session['idUser']) listaVuelosUser = FlightUser.SelectUsers(user.idUser) return render_template('UserHome.html', active=active, admin=user.administrador, listaVuelosUser=listaVuelosUser)
def confirmSignUp(): name = request.form.get('name') lastname = request.form.get('lastname') mail = request.form.get('mail') password = request.form.get('password') confirmPassword = request.form.get('confirmPassword') if confirmPassword != password: return render_template('SignUp.html') user = User("NULL", name, lastname, mail, password) user.InsertUser(name, lastname, mail, password) if not user.idUser in session: session['idUser'] = user.idUser return redirect('/home')
def confirmSignIn(): mail = request.form.get('mail') password = request.form.get('password') user = User.SelectUserMailPassword(mail, password) if user is None: return redirect('/signIn') if not user.idUser in session: session['idUser'] = user.idUser return redirect('/home')
def editUser(): idUser = request.form.get('idUser') name = request.form.get('name') lastname = request.form.get('lastname') mail = request.form.get('mail') password = request.form.get('password') user = User.SelectUserID(idUser) user.UpdateUser(name, lastname, mail, password) return redirect('/user')
def insertFlightUser(): idFlight = request.form.get('idFlight') idUser = request.form.get('idUser') seatNumber = request.form.get('seatNumber') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(idUser) seat = Seats.SelectSeatsID(seatNumber) flightUser = FlightUser(flight, user, seat) flightUser.InsertFlightUser() return redirect('/flightUser')
def reservarViaje(): idFlight = request.form.get('idFlight') idSeat = request.form.get('idSeat') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(session['idUser']) seat = Seats.SelectSeatsID(idSeat) flightUser = FlightUser(flight, user, seat) if flightUser not in FlightUser.SelectFlightUser(): flightUser.InsertFlightUser() return redirect('home')
def editFlightUser(): oldIDFlight = request.form.get('oldIDFlight') oldIDUser = request.form.get('oldIDUser') idFlight = request.form.get('idFlight') idUser = request.form.get('idUser') seatNumber = request.form.get('seatNumber') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(idUser) seat = Seats.SelectSeatsID(seatNumber) flightUser = FlightUser.SelectFlightUserID(oldIDFlight, oldIDUser) flightUser.UpdateFlightUser(flight, user, seat) return redirect('/flightUser')
def deleteUser(): idUser = request.args.get('idUser') User.DeleteUser(idUser) return redirect("/user")
def user(): listaUser = User.SelectUser() return render_template('User.html', listaUser=listaUser)
def get_user_info(username): data = { "query": 'query {user(login:"******"){contributedRepositories(last:100){edges{node{name url}}}followers(last:20){edges{node{login' % username + '}}}following(last:20){edges{node{login}}}issues(last:20){edges{node{labels(first:5){nodes{name}}' + '}}}organizations(last:20){edges{node{name}}}pullRequests(last:20){edges{node{title' + '}}}repositories(last:20){edges{node{name url}}}starredRepositories(last:20){edges{node{name}}}' + 'watching(last:20){edges{node{name}}}}}' } headers = { 'Authorization': 'token 8c12627af039588a6c63e9a735e8a145dd641fee' } req = request.Request(url='https://api.github.com/graphql', data=json.dumps(data).encode('utf-8'), headers=headers) resopnse = request.urlopen(req) infomation = resopnse.read().decode('utf-8') info = json.loads(infomation) addinfo.append_contributedRepositories( info, addinfo.contributedRepositories_list) addinfo.append_contributedRepositories_url( info, addinfo.contributedRepositories_url_list) addinfo.append_followers(info, addinfo.followers_list) addinfo.append_following(info, addinfo.following_list) addinfo.append_issues(info, addinfo.issues_list) addinfo.append_organizations(info, addinfo.organizations_list) addinfo.append_pullRequests(info, addinfo.pullRequests_list) addinfo.append_repositories(info, addinfo.repositories_list) addinfo.append_repositories_url(info, addinfo.repositories_url_list) addinfo.append_starredRepositories(info, addinfo.starredRepositories_list) addinfo.append_watching(info, addinfo.watching_list) user_info = User(addinfo.contributedRepositories_list, addinfo.contributedRepositories_url_list, addinfo.followers_list, addinfo.following_list, addinfo.issues_list, addinfo.organizations_list, addinfo.pullRequests_list, addinfo.repositories_list, addinfo.repositories_url_list, addinfo.starredRepositories_list, addinfo.watching_list) '''print('%s %s %s %s %s %s %s %s %s' % (user_info.set_contributedRepositories(), user_info.set_contributedRepositories_url(), user_info.set_followers(), user_info.set_following(), user_info.set_issues(), user_info.set_organizations(), user_info.set_pullRequests(), user_info.set_repositories(),user_info.ser_repositories_url(),user_info.set_starredRepositories(),user_info.set_watching())) ''' filename = username with open(filename + '.json', 'w') as f: f.write( str(user_info.set_contributedRepositories()) + str(user_info.set_contributedRepositories_url()) + str(user_info.set_followers()) + str(user_info.set_following()) + str(user_info.set_issues()) + str(user_info.set_organizations()) + str(user_info.set_pullRequests()) + str(user_info.set_repositories()) + str(user_info.set_repositories_url()) + str(user_info.set_starredRepositories()) + str(user_info.set_watching())) following_username = addinfo.following_list return following_username
def GetFlightUser(dic): flight = Flight.SelectFlightsID(dic["idFlight"]) user = User.SelectUserID(dic["idUser"]) seat = Seats.SelectSeatsID(dic["seatNumber"]) return flight, user, seat
..............Menu Options................ . . . [1] User register . . [2] Show Users . . [3] Create post . . [4] Create comment . . [5] List post by user . . [6] Show the comments of post . . [7] Exit . .......................................... """) optionSelected = int(input("Select an option: ")) return optionSelected user = User() optionSelected = menu() while optionSelected > 0 and optionSelected <= 7: if optionSelected == 1: userDictyonary = user.createUser(userDictyonary) elif optionSelected == 2: user.showAllUsers(userDictyonary) elif optionSelected == 3: postDictyonary = user.createPost(postDictyonary, userDictyonary) elif optionSelected == 4: commentDictyonary = user.createComment(commentDictyonary,