Figured out some more migration project stuff.
This commit is contained in:
Binary file not shown.
@ -25,31 +25,21 @@ def get(url):
|
||||
|
||||
|
||||
def post(url, payload):
|
||||
try:
|
||||
post_response = requests.post(url, headers=HEADERS, json=payload)
|
||||
print(f"Executed Post Request. Status code is {post_response.status_code}")
|
||||
except Exception as h:
|
||||
print(
|
||||
f"Error occurred. Here's the info: {h} and text: {post_response.text}"
|
||||
)
|
||||
finally:
|
||||
try:
|
||||
json_post = post_response.json()
|
||||
# print(f"JSONResponse: {json_post}")
|
||||
request_subject = url.split("/")[-2:]
|
||||
post_response = requests.post(url, headers=HEADERS, json=payload)
|
||||
print(f"Executed Post Request for {str(request_subject)}.")
|
||||
if str(post_response.status_code).startswith('2'):
|
||||
print(f"Status code is {post_response.status_code}")
|
||||
return post_response.json()
|
||||
else:
|
||||
print(f"Status code is {post_response.status_code}")
|
||||
json_post = post_response.json()
|
||||
if json_post:
|
||||
print(json_post)
|
||||
return json_post
|
||||
except JSONDecodeError as e:
|
||||
print(f"Error occurred. Here's the info: {e} and text: {post_response.text}")
|
||||
print(f"PostResponse: {post_response}")
|
||||
else:
|
||||
return post_response
|
||||
finally:
|
||||
# PP.pprint(json_get)
|
||||
pass
|
||||
#
|
||||
# def post(url, payload):
|
||||
# post_response = requests.post(url, headers=HEADERS, json=payload)
|
||||
# print(f"Executed Post Request. Status code is {post_response.status_code}")
|
||||
# print(post_response.text)
|
||||
# return post_response
|
||||
|
||||
|
||||
def delete(url):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user