Skip to content

Commit 320172c

Browse files
authored
Merge pull request #32 from Celeo/feat-store-headers
Store headers from HTTP responses
2 parents 6c1445e + dfb75ab commit 320172c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

preston/preston.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def __init__(self, **kwargs: Any) -> None:
6666
self.access_token = kwargs.get("access_token")
6767
self.access_expiration = kwargs.get("access_expiration")
6868
self.refresh_token = kwargs.get("refresh_token")
69+
self.stored_headers = []
6970
self._kwargs = kwargs
7071
if not kwargs.get("no_update_token", False):
7172
self._try_refresh_access_token()
@@ -253,7 +254,7 @@ def _get_path_for_op_id(self, id: str) -> Optional[str]:
253254
return path_key
254255
return None
255256

256-
def _insert_vars(self, path: str, data: dict) -> [str, dict]:
257+
def _insert_vars(self, path: str, data: dict) -> tuple[str, dict]:
257258
"""Inserts variables into the ESI URL path.
258259
259260
Args:
@@ -318,6 +319,7 @@ def get_path(self, path: str, data: dict) -> Tuple[dict, dict]:
318319
self._try_refresh_access_token()
319320
resp = self.session.get(target_url)
320321
self.cache.set(resp)
322+
self.stored_headers.insert(0, resp.headers)
321323
if resp.text:
322324
return resp.json()
323325
return None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "preston"
3-
version = "4.5.0"
3+
version = "4.6.0"
44
description = "EVE ESI API access tool"
55
authors = ["Celeo <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)