You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# CHANGELOG
2
2
3
+
## Next Release
4
+
5
+
- Adds new `RequestHook` and `ResponseHook` events. (un)subscribe to them with the new `subscribe_to_request_hook`, `subscribe_to_response_hook`, `unsubscribe_from_request_hook`, or `unsubscribe_from_response_hook` methods of an `EasyPostClient`
6
+
3
7
## v8.0.0 (2023-06-06)
4
8
5
9
See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-7x-to-80) for more details.
Users can subscribe to HTTP requests and responses via the `RequestHook` and `ResponseHook` objects. To do so, pass a function to the `subscribe_to_request_hook` or `subscribe_to_response_hook` methods of an `EasyPostClient` object:
68
+
69
+
```python
70
+
defcustom_function(**kwargs):
71
+
"""Pass your code here, data about the request/response is contained within `kwargs`."""
72
+
print(f"Received a request with the status code of: {kwargs.get('http_status')}")
# Make your API calls here, your custom_function will trigger once a response is received
79
+
```
80
+
81
+
You can also unsubscribe your functions in a similar manner by using the `unsubscribe_from_request_hook` and `unsubscribe_from_response_hook` methods of a client object.
82
+
65
83
## Documentation
66
84
67
85
API documentation can be found at: <https://easypost.com/docs/api>.
0 commit comments