Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 6a9e858

Browse files
committed
Change response
1 parent 605ccc7 commit 6a9e858

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

client.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,17 @@ def http_request(self, method, url, body=None, headers=None):
8888

8989
# Return the status code and the body of the response
9090
response_dict = {
91-
"status": status_code,
92-
"body": body.decode("utf-8", errors="ignore"),
93-
"headers": headers # Optionally include headers in the response
91+
"status": f"{status_code}",
92+
"body": f"{body.decode('utf-8', errors='ignore')}",
93+
"headers": f"{headers}" # Optionally include headers in the response
9494
}
9595

9696
# Convert the dictionary to JSON
9797
response_json = json.dumps(response_dict, indent=4)
98-
98+
print(json.loads(response_json))
99+
return json.loads(response_json)
99100
# Return the JSON response
100-
return response_json
101-
102-
101+
103102
def head(self, url, headers=None):
104103
"""Carry out a HEAD request and returns status_code and empty body."""
105104
return self.http_request("HEAD", url, headers=headers)

0 commit comments

Comments
 (0)