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 = []