-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequest.py
More file actions
27 lines (22 loc) · 839 Bytes
/
Request.py
File metadata and controls
27 lines (22 loc) · 839 Bytes
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
class Request:
def _init_(self, method = 'NORM'):
self.granted = False
self._method = method
if self._method == 'GET':
self.size = np.random.randint(1, 5)
elif self._method == 'POST':
self.size = np.random.randint(3, 10)
elif self._method == 'NORM':
self.size = 4
else:
#print("No such method")
self.size = 4
self._method = 'NORM'
self.src_ip = '.'.join(tuple(map(str,np.random.randint(0, 255, 4))))
def _del_(self):
#print("Request Complete .. Being deleted.")
pass
def _repr_(self):
return f"Request('{self._method}')"
def _str_(self):
return f"Request Object\nMethod: {self._method}\nSize: {self.size}\nGranted: {self.granted}"