-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathrequest_observer.py
More file actions
34 lines (25 loc) · 862 Bytes
/
request_observer.py
File metadata and controls
34 lines (25 loc) · 862 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
28
29
30
31
32
33
34
"""
Interface for request observer, which allows to catch odata request processing details
Author: Michal Nezerka <michal.nezerka@gmail.com>
Date: 2021-05-14
"""
from abc import ABC, abstractmethod
class RequestObserver(ABC):
"""
The RequestObserver interface declares methods for observing odata request processing.
"""
@abstractmethod
def http_response(self, response, request) -> None:
"""
Get http response together with related http request object.
"""
class RequestObserverLastCall(RequestObserver):
"""
The implementation of RequestObserver that stored request and response of the last call
"""
def __init__(self):
self.response = None
self.request = None
def http_response(self, response, request):
self.response = response
self.request = request