From 9fa43809cb7315e8c83f6079a1854686ef5b3dce Mon Sep 17 00:00:00 2001 From: Raffu Khondaker <2022rkhondak@tjhsst.edu> Date: Tue, 16 Jun 2020 15:00:39 -0400 Subject: [PATCH] db methods comments student --- CLI/student.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CLI/student.py b/CLI/student.py index fd75366..3281fda 100644 --- a/CLI/student.py +++ b/CLI/student.py @@ -28,30 +28,34 @@ def getStudent(ion_user): return None print(r.status_code) +#makes a GET request to given url, returns dict def getDB(url): r = requests.get(url = url, auth=('raffukhondaker','hackgroup1')) print("GET:" + str(r.status_code)) return(r.json()) +#makes a PATCH (updates instance) request to given url, returns dict +def patchDB(data, url): + r = requests.patch(url = url, data=data, auth=('raffukhondaker','hackgroup1')) + print("PATCH:" + str(r.status_code)) + return(r.json()) + +#makes a POST (makes new instance) request to given url, returns dict def postDB(data, url): r = requests.post(url = url, data=data, auth=('raffukhondaker','hackgroup1')) print("POST:" + str(r.status_code)) return(r.json()) +#makes a PUT (overwrites instance) request to given url, returns dict def putDB(data, url): r = requests.put(url = url, data=data, auth=('raffukhondaker','hackgroup1')) print("PUT:" + str(r.status_code)) return(r.json()) -def patchDB(data, url): - r = requests.patch(url = url, data=data, auth=('raffukhondaker','hackgroup1')) - print("PATH:" + str(r.status_code)) - return(r.json()) - +#makes a DELETE (delete instance) request to given url, returns dict def delDB(url): r = requests.delete(url = url, auth=('raffukhondaker','hackgroup1')) print("DELETE:" + str(r.status_code)) - return None def command(command): ar = []