-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
47 lines (41 loc) · 1.25 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class HttpRequest:
timestamp: float
response_body: str
response_status_code: int
mime_type: str
request_full_path: str
def __init__(
self,
timestamp: float,
response_body: str,
response_status_code: int,
mime_type: str,
request_full_path: str,
):
self.timestamp = timestamp
self.response_body = response_body
self.response_status_code = response_status_code
self.mime_type = mime_type
self.request_full_path = request_full_path
def to_dict(self):
return {
"timestamp": self.timestamp,
"response_body": self.response_body,
"response_status_code": self.response_status_code,
"mime_type": self.mime_type,
"request_full_path": self.request_full_path,
}
class Resource:
resource: str
method: str
requests: list[HttpRequest]
def __init__(self, resource: str, method: str):
self.resource = resource
self.method = method
self.requests = list[HttpRequest]()
def to_dict(self):
return {
"resource": self.resource,
"method": self.method,
"requests": [item.to_dict() for item in self.requests],
}