(20260216) Attendance mark is now truly async.
This commit is contained in:
@@ -461,7 +461,7 @@ class AsyncTheCAOffice:
|
||||
# applicant_notes = json.to_string(applicant_notes, no_space = True)
|
||||
|
||||
# Make the API call:
|
||||
response = requests.post(
|
||||
response = await self._http_client.post(
|
||||
url = self.TEAM_ADD_URL,
|
||||
headers = {"X-Session-Token": self.__session_token},
|
||||
json = {
|
||||
@@ -526,6 +526,8 @@ class AsyncTheCAOffice:
|
||||
:return: True if the attendance was marked, else False.
|
||||
"""
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
# Prepare the payload:
|
||||
json_payload = {
|
||||
"date": (
|
||||
@@ -542,7 +544,7 @@ class AsyncTheCAOffice:
|
||||
json_payload["jsonNotes"] = json_notes
|
||||
|
||||
# Make the API call:
|
||||
response = requests.post(
|
||||
response = await self._http_client.post(
|
||||
url = self.ATTENDANCE_MARK_URL,
|
||||
headers = {"X-Session-Token": self.__session_token},
|
||||
json = json_payload
|
||||
@@ -564,6 +566,7 @@ class AsyncTheCAOffice:
|
||||
"Attendance marked.",
|
||||
user_id,
|
||||
)
|
||||
print("ONE TIME TAKEN:", time.time() - start_time)
|
||||
return True
|
||||
|
||||
# If the call failed:
|
||||
@@ -575,6 +578,7 @@ class AsyncTheCAOffice:
|
||||
user_id,
|
||||
response_json
|
||||
)
|
||||
print("ONE TIME TAKEN:", time.time() - start_time)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user