Added the create project and item functions for the mark a course as completed app. Reorganized a bit and added classes for the project as well.

This commit is contained in:
Norm Rasmussen
2024-08-31 08:26:18 -04:00
parent 6936530289
commit e49d3d0a01
8 changed files with 152 additions and 5 deletions

View File

@ -25,7 +25,7 @@ def get(url):
def post(url, payload):
try:
post_response = requests.get(url, headers=HEADERS, json=payload)
post_response = requests.post(url, headers=HEADERS, json=payload)
print(f"Executed Post Request. Status code is {get_response.status_code}")
except HTTPError as h:
print(
@ -34,3 +34,15 @@ def post(url, payload):
finally:
json_post = get_response.json()
# PP.pprint(json_post)
def delete(url):
try:
get_response = requests.delete(url, headers=HEADERS)
# print(f"Executed Get Request. Status code is {get_response.status_code}")
except HTTPError as h:
print(
f"Error occurred. Here's the info: {h} and status code: {get_response.status_code}"
)
finally:
return get_response