def requesting(): search = request.args.get('query', '') if not 'access_token' in session: flash('You cannot post without an account.', 'danger') return render_template('index.html') github = GitHub(access_token=session['access_token']) results1 = github.get('/user/starred') results2 = github.get('/search/repositories', {'q': search}) results2 = results2.get('items', []) return render_template('tutorial/requesting.html', tutorial1=results1[:5], tutorial2=results2[:5], query=search)
def requesting(): search = request.args.get('query', '') if not 'access_token' in session: flash('This tutorial needs an authenticated user to make the request. Please sign in with your GitHub account.', 'danger') return render_template('tutorial/requesting.html') github = GitHub(access_token=session['access_token']) results1 = github.get('/user/starred') results2 = github.get('/search/repositories', { 'q': search } ) results2 = results2.get('items', []) return render_template('tutorial/requesting.html', tutorial1 = results1[:5], tutorial2 = results2[:5], query = search )