Skip to content

Commit

Permalink
Merge pull request #32 from Celeo/feat-store-headers
Browse files Browse the repository at this point in the history
Store headers from HTTP responses
  • Loading branch information
Celeo authored Nov 13, 2024
2 parents 6c1445e + dfb75ab commit 320172c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion preston/preston.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, **kwargs: Any) -> None:
self.access_token = kwargs.get("access_token")
self.access_expiration = kwargs.get("access_expiration")
self.refresh_token = kwargs.get("refresh_token")
self.stored_headers = []
self._kwargs = kwargs
if not kwargs.get("no_update_token", False):
self._try_refresh_access_token()
Expand Down Expand Up @@ -253,7 +254,7 @@ def _get_path_for_op_id(self, id: str) -> Optional[str]:
return path_key
return None

def _insert_vars(self, path: str, data: dict) -> [str, dict]:
def _insert_vars(self, path: str, data: dict) -> tuple[str, dict]:
"""Inserts variables into the ESI URL path.
Args:
Expand Down Expand Up @@ -318,6 +319,7 @@ def get_path(self, path: str, data: dict) -> Tuple[dict, dict]:
self._try_refresh_access_token()
resp = self.session.get(target_url)
self.cache.set(resp)
self.stored_headers.insert(0, resp.headers)
if resp.text:
return resp.json()
return None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "preston"
version = "4.5.0"
version = "4.6.0"
description = "EVE ESI API access tool"
authors = ["Celeo <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 320172c

Please sign in to comment.