Skip to content

Commit

Permalink
lab5 v1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason-g-bit committed Nov 4, 2024
1 parent b148fd4 commit 1642d01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask import Flask, render_template, request
import requests as re


app = Flask(__name__)
Expand Down Expand Up @@ -27,9 +28,15 @@ def process_query(q):
@app.route("/submitgetgithubusername", methods=["POST"])
def submitgetgithubusername():
input_name = request.form.get("name")
response = re.get("https://api.github.com/users/{}/repos".format(input_name))
if response.status_code == 200:
repos = response.json() # data returned is a list of ‘repository’ entities
for repo in repos:
print(repo["full_name"])
return render_template("github_username.html", name=input_name)


@app.route("/get_github_username", methods=["POST"])

@app.route("/get_github_username", methods=["GET"])
def get_github_username():
return render_template("get_github_username.html")

0 comments on commit 1642d01

Please sign in to comment.